一、安装分两步
- 安装libmemcached,目标是so和header文件
- 安装memcachedphp extensions
二、安装libmemcached
wget https://launchpad.net/libmemcached/1.0/0.53/+download/libmemcached-0.53.tar.gz
tar xvfz libmemcached-0.53.tar.gz
cd libmemcached-0.53
./configure --prefix=/usr/local/libmemcached
make && make install
三、安装PHP扩展
wget http://pecl.php.net/get/memcached-2.0.0.tgz
tar zvxf memcached-2.0.0.tgz
cd memcached-2.0.0/
./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/
make && make install
- make install 是 把memcached.so 安装到/usr/local/php/lib/php/extensions/no-debug-zts-20121212/,这个目录随着php的版本不同而不同
四、最后一步
- 修改php.ini,加上 extension = "/usr/local/php/lib/php/extensions/no-debug-zts-20121212/memcached.so"