centos7安装memcached以及phpmemcached扩展
1.安装memcached:
yum -y install memcached
2.设置memcached开机启动:
chkconfig memcached on
3.立即启动memcached服务:
service memcached start
4.查找memcached安装位置:
rpm -ql memcached
5.查看memcached配置文件:
cat /etc/sysconfig/memcached
6.执行
netstat -tunlp | grep memcached
看到11211端口,说明memcached安装成功。
7.安装libmemached:
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18/
./configure –prefix=/usr/lib/libmemcached
make && make install
8.下载memcache扩展包并安装:(安装git: yum -y install git)
cd php-memcached/
git checkout php7
/usr/local/php716/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php716/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/lib/libmemcached -prefix=/usr/local/phpmemcached –disable-memcached-sasl
make && make install
9.修改php.inivim /usr/local/php716/lib/php.ini
#在END前加上extension=memcached.so;# 重启php-fpm
注意:如果发现找不到php.ini文件,解决方法:
<<<————–>>>
去原php的源码目录(就是刚开始下载的php压缩包)查看php.ini-development或php.ini-production
再当前环境选择将哪个文件重命名为php.ini
并同时将php.ini文件复制到phpinfo()中php.ini所在的目录中即可
(在phpinfo里面搜索php.ini,查看php.ini应该在哪个路径)
<<<————–>>>