一、memcached安裝:
1、安裝libevent,下載下傳位址:http://libevent.org/
tar -zxvf libevent-2.0.22-stable.tar.gz
cd libevent目錄
./configure --prefix=/usr/libevent
make && make install
安裝完成
2、安裝memcached,下載下傳位址:http://memcached.org/
tar -zxvf memcached.tar.gz
cd memcached目錄
./configure --prefix=/usr/memcached --with-libevent=/usr/libevent
make && make install
安裝完成
啟動:
進入memcached/bin, ./memcached -u root -d
檢視運作狀态:ps -ef |grep memcached
3、安裝libmemcached,下載下傳位址:https://launchpad.net/libmemcached
tar -zxvf libmemcached
cd libmemcached
./configure -prefix=/usr/local/libmemcached -with-memcached
make && make install
4、php-memcached擴充安裝:
git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached
/usr/local/php/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached --disable-memcached-sasl
make && make install
安裝完成後提示:/usr/local/php/lib/php/extensions/no-debug-zts-20151012/
5、php.ini中添加如下配置:
[Memcached]
extension_dir = "/home/local/php/lib/php/extensions/no-debug-non-zts-20160303"
extension = memcached.so
重新開機php-fpm即可。
過程中提示 :
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.錯誤
解決辦法: yum install m4
yum install autoconf