Centos 安装memcached
yum安装Memcached
yum -y install memcached
vi /etc/sysconfig/memcached 修改端口号例 :11211
打开/etc/sysconfig/iptables文件
vi /etc/sysconfig/iptables
在REJECT行之前添加如下代码
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT
保存和关闭文件,重启防火墙
systemctl restart iptables.service
启动memcached
systemctl start memcached.service
systemctl enable memcached.service 开机启动
下载php扩展
wget https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
unzip php7.zip //解压文件夹为pecl-memcache-php7
$
yum install zlib-devel
$ cd
pecl-memcache-php7
$ phpize
$ ./configure
$ make && make install
返回
memcache.so 路径 /usr/lib64/php/modules/
修改php.ini 加载Memcache组件
[memcache] extension_dir = "/usr/lib64/php/modules/" extension = "memcache.so"
重启 httpd systemctl restart httpd.service
版权声明:本文著作权归原作者所有,如有侵权,请联系我们立即删除!