centos安装memcached以及php7memcache扩展

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)

git clone https://github.com/php-memcached-dev/php-memcached.git

cd php-memcached/

git checkout php7

/usr/local/php/bin/phpize

./configure -enable-memcached -with-php-config=/usr/local/php/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/php/lib/php.ini

#在END前加上extension=memcached.so;

 重启php-fpm:service php-fpm restart

重启nginx服务:service nginx restart

猜你喜欢

转载自blog.csdn.net/m0_37971044/article/details/82906156