php扩展分为两种:memcache、memcached
memcache安装: tar -zxvf memcache-2.2.5.tgz cd memcache-2.2.5 /usr/local/php/bin/phpize ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir make && make install
cd /usr/local/php/etc/php.d touch /usr/local/php/etc/php.d/memcache.ini echo "extension = \"memcache.so\"" >> /usr/local/php/etc/php.d/memcache.ini echo "memcache.chunk_size = 32768" >> /usr/local/php/etc/php.d/memcache.ini
cd /usr/local/php/etc/php.d # vi memcache.ini
写入: extension = "memcache.so" 成功如图所示:
memcached安装: wget http://launchpad.net/libmemcache ... mcached-0.42.tar.gz
wget http://pecl.php.net/get/memcached-1.0.2.tgz 首先安装libmemcached库
tar zxvf libmemcached-0.42.tar.gz cd libmemcached-0.42 /configure make && make install 安装php memcached扩展
tar zxvf memcached-1.0.2.tar.gz cd memcached-1.0.2 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install
vi /usr/local/webserver/php/etc/php.ini 加上extension=memcached.so重起一下服务就可以了。 或者 cd /usr/local/php/etc/php.d # vi memcached.ini
写入: extension = "memcached.so" 成功如图所示:
|