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扩展包并安装:
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar -zxvf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
(如果失败重新来换作)
./configure --enable-memcache --with-php-config=/usr/bin/php-config --with-zlib-dir
make && make install
修改php文件 vi /etc/php.ini
添加extension = memcache.so
重启 apache
systemctl restart httpd.service #重启apache