centos的PHP编译安装memcached扩展
php连接memcached缓存服务器的客户端有两个:一个是memcache是比较底层的开发库,一个是memcached是比较新的开发库,php安装这两个扩展中的任意一个后就可以在编写php代码时使用的memcached缓存数据,达到缓存php执行的结果,下面介绍的是后者的编译安装
1、下载libmemcached库 (安装memcached需要先安装libmemcached库)
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
2、下载php memcached扩展
wget http://pecl.php.net/get/memcached-2.2.0.tgz
3、安装libmemcached
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached --with-memcached
make
make install
4、安装PHP的memcached扩展 (安装完成后,会在php的模块目录下生产memcached.so模块文件)
tar -zxvf memcached-2.2.0.tgz
cd memcached-2.2.0
运行phpize命令生成configure配置文件: /usr/local/php/bin/phpize
./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ --prefix=/usr/local/phpmemcached --with-memcached --disable-memcached-sasl
make
make install
5、配置php,加载memcahed扩展
extension=memcached.so
6、重启加载php配置文件