登录服务器挨步执行:
# sudo apt-get -y install gcc make autoconf libc-dev pkg-config
# sudo apt-get -y install zlib1g-dev
# sudo apt-get -y install libmemcached-dev
# sudo pecl install memcached
展示 libmemcached directory [no] :
时输入 no --disable-memcached-sasl
,之后 一路回车
修改 http 配置文件,默认目录在 /etc/php/conf.d
也可能在 /usr/local/etc/php/conf.d
找不到话搜一下
# cd /etc/php/conf.d
# echo "extension=memcached.so" > memcached.ini
重启服务
# service php-fpm restart
# service apache2 restart
可以查询一下安装状态
# php -i | grep -i "memcached support"
memcached support => enabled