memcache安装:

wget http://www.monkey.org/~provos/libevent-1.2.tar.gz

tar zxvf libevent-1.2.tar.gz

cd libevent-1.2

./configure --prefix=/usr

make

make install

wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz

tar zxvf memcached-1.2.0.tar.gz

cd memcached-1.2.0

./configure --with-libevent=/usr

make

make install

安装Memcache的PHP扩展

pecl install memcache

Build process completed successfully

Installing '/usr/lib64/php/modules/memcache.so'

install ok: channel://pecl.php.net/memcache-2.2.7

configuration option "php_ini" is not set to php.ini location

You should add "extension=memcache.so" to php.ini

编辑php配置文件

vi /etc/php.ini

extension_dir = "/usr/lib64/php/modules/"

extension=memcache.so

ln -s /usr/lib/libevent-1.2.so.1 /usr/lib64/libevent-1.2.so.1

启动memcached

/usr/local/bin/memcached -d -m 10 -u root -l 192.168.10.109 -p 12000 -c 256 -P /tmp/memcached.pid