因为php默认是没有memcache模块的
所以要安装memacache
软件下载:
http://pecl.php.net/package/memcache
wget下载然后用tar zxf 解压
然后cd进去
yum install autoconf
然后phpize
之后就可以直接编译./configure && make && make install
安装之后复制测试文件到nginx发布目录中
cd进入到安装包里面
ls看一下,里面会有example.php,memcache.php
cp example.php memcache.php /data/php/
然后编辑文件
vim /data/php/memcache.php
该你想改的用户和密码
define('ADMIN_USERNAME','admin'); // Admin Username
define('ADMIN_PASSWORD','lee'); src // Admin Password
$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array
接下来配置php加载memcache模块
vim /usr/local/php/etc/php.ini ;extension=zip extension=memcache ;zend_extension=opcache [root@Nginx ~]# systemctl reload php-fpm
然后重启php-fpm服务
最后部署memcache就好了
yum install memcached -y
systemctl enable --now memcached.service
netstat -antlupe | grep memcache
到这里配置完成