centos'的yum安装php的memcache扩展

  让php能使用memcached服务的扩展有两种:memcache 和 memcached

  

  1. 先安装libmemcached扩展

    yum -y install libmemcached

  2. 安装php-pecl-memcache扩展

    yum -y install php-pecl-memcache

  3. 重启php

  4.可通过phpinfo()查看是否安装了memcache扩展

  5.安装成功后有可能在服务器能够通过telnet连接使用memcached服务,但是在php中通过new Memcache,加connect后返回的错误是连接被拒绝,这个原因是因为selinux安全机制的不允许memcached访问11211端口,所以必须对sulinux进行设置

     临时生效的方法: setenforce Permissive

     永久生效的方法:修改/etc/selinux/config文件,SELINUX=enforcing 改为 SELINUX=disabled,从而关闭selinux

   

猜你喜欢

转载自wsluozefeng.iteye.com/blog/2167191