参考: https://amon.org/php-memcached
环境:CentOS 8
【安装】
安装 memcached :
yum install memcached
查看:
memcached -h
配置信息:/etc/sysconfig/memcached
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="-l 127.0.0.1,::1"
启动:
memcached -d -u root -l 127.0.0.1 -p 11211 -m 128
查看状态:
memcached-tool 127.0.0.1:11211 stats
设置开机自动启动:
chkconfig memcached on
安装 libmemcached:
yum install libmemcached
安装php-memcached:
yum install php-memcached
【设置】
修改php.ini:
/usr/local/php/etc/php.ini
在文件最后面加入memcached的扩展路径:
; [memcached] extension = "memcached.so"
重启php服务
service php-fpm restart