1.获取编译工具下面要用来编译源代码,如果已经安装可跳过这步
[bash] sudo apt-get install build-essential [/bash]
2.安装PEAR and memcached
[bash] sudo apt-get install php-pear memcached [/bash]
3.编译libmemcached
到 https://launchpad.net/libmemcached/+download 下载最新的libmemcached源代码,解压编译安装步骤如下:
Extract the files with your preferred method, or type:
[bash] tar -xzf libmemcached-0.37.tar.gz [/bash]
Move into the extracted directory:
[bash] cd libmemcached-0.37/ [/bash]
Configure the package.
[bash] ./configure –with-memcached [/bash]
Make.
[bash] make [/bash]
Make install. Note this probably will require sudo rights.
[bash] sudo make install [/bash]
4.PECL
[bash] sudo pecl install memcached [/bash]
When this process completed, you should see something like this:
[bash]
Build process completed successfully
Installing ‘/usr/lib/php5/20060613+lfs/memcached.so’
install ok: channel://pecl.php.net/memcached-1.0.0
Extension memcached enabled in php.ini
[/bash]
5.修改PHP.INI添加扩展
[bash] sudo vi /etc/php5/fpm/php.ini [/bash]
在php.ini 中添加“extension = memcached.so”
重启PHP-FPM服务
[bash] sudo service php5-fpm restart [/bash]