1.#wget http://pecl.php.net/get/memcache-2.2.6.tgz
2.#tar zxvf memcache-2.2.6.tgz
3.# cd memcache-2.2.6
4.#/usr/local/webserver/php/bin/phpize
注意:这有可能报错
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
解决办法:
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz # cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
# tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install
centOS用yum让我更容易把没安装的包安装好
#yum install m4
#yum install autoconf 5.#./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir
6.#make
7.#make install
显示如下信息时为安装成功:
Installing shared extensions:/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/
8.#vi /usr/local/webserver/php/lib/php.ini
查找extension_dir = "./",去掉分号,并改为extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/"
在extension_dir下面加上  extension = "memcache.so"
保存
重启apache启动
查看phpinfo中是否有memcache一项,有则成功