Memcached PHP扩展安装

Eave 2014.12.17 12:57

1、安装libmemcached库

下载地址:https://launchpad.net/libmemcached/+download

$ wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
$ tar -zxf libmemcached-1.0.18.tar.gz
$ cd libmemcached-1.0.18
$ ./configure --prefix=/usr/local/libmemcached --with-memcached
$ make && make install

2、安装php memcached扩展

下载地址:http://pecl.php.net/package/memcached

$ wget http://pecl.php.net/get/memcached-2.2.0.tgz
$ tar -zxf memcached-2.2.0.tgz
$ cd memcached-2.2.0
$ /usr/local/php/bin/phpize
$ ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached
$ make && make install

3、在php.ini里添加

$ vim /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"
extension = "memcached.so"

重启PHP服务