memcached擴展php

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

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章