1.安装memcache服务端
cd /usr/local
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/usr/local/libevent
make && install
2.安装memcached
wget http://memcached.org/files/memcached-1.4.25.tar.gz
tar -zxvf memcached-1.4.25.tar.gz
cd memcached-1.4.25
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
make && make install
3.安装libmemcached
/*安装依赖*/
yum install libmemcached libmemcached-devel
4.安装php memecached拓展
/*要使用phpize 如果没有安装就autoconf*/
yum install m4 yum install autoconf
phpize
./configure --with-php-config=/lnmp/php/bin/php-config
make && make install
/*下面提示告诉我们memecached.so的拓展在哪*/
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/
5.启动memcached
memcached -d -m 2048 -l 127.0.0.1 -p 11211 -u root -c 1024 –P /var/memcached/memcached.pid
6.更改php.ini 增加memcached拓展
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/memcached.so;