首先必须完成必要的软件安装,memcached是php连接memcached服务器的php扩展它的名字就叫memcached
以前有个叫memcache也是php连接memcached服务器的扩展,它的名字叫memcache
php的memcache和memcached扩展都是作为客户端去连接memcached服务器
但memcached作为客户端比memcache性能更好功能更强大,而且memcache已经停止更新了,因此现在使用扩展的话就用
memcached
接下来安装必要组件:wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
mkdir /usr/local/libmemcached
tar xf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached --with-memcached
make && make install
wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar xf memcached-2.2.0.tgz cd memcached-2.2.0
/usr/local/php/bin/phpize (生成configure文件)
./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --
enable-memcached
make && make install
echo "extension=memcached.so" >> /etc/phpini
service php-fpm restart
php支持使用memcached到这里就完成了