天天看點

memcached擴充phpmemcached擴充包安裝

memcached擴充包安裝

memcached擴充包依賴libmemcached,是以先安裝libmemcached

wget  https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar zxf libmemcached-1.0.18.tar.gz 
cd libmemcached-1.0.18/
./configure --prefix=/usr/local/libmemcached --with-memcached
make && make install
           

再安裝memcached擴充包,由于pecl上的擴充包暫未支援到php7,是以隻能去github上面拉包

git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached-master/
/usr/local/php/bin/phpize      //沒有這個指令的可以用yum安裝一個
           

如果報錯Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

yum -y install autoconf
./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make && make install
           

然後再php.ini檔案中添加 extension=“memcached.so” ,追加檔案末尾就可以

重新開機php-fpm

/etc/rc.d/init.d/php-fpm restart
           
memcached擴充phpmemcached擴充包安裝