安装依赖库 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
$ make && make install
安装php7的memcached扩展
$ git clone https://github.com/php-memcached-dev/php-memcached.git
$ cd php-memcached/
$ git checkout php7
$ phpize # 如果未安装php-dev需先安装
$ ./configure --disable-memcached-sasl
$ make && make install
启动扩展
修改配置文件
$ sudo vim /etc/php/7.0/fpm/php.ini
在末尾添加
[Memcached]
extension=memcached.so
重启php
$ sudo systemctl restart php7.0-fpm
网友评论