lnmp1.4 手动编译安装memcached

lnmp一键包里的memcached莫名用不了,于是自己手动编译一个用。

参考文章:https://www.cnblogs.com/firstForEver/p/4974132.html

环境为centos7


首先安装memcached

yum install memcached

然后启动memcached,只监听内网。

/usr/bin/memcached -d -uwww -p 11211 -m 200 -l 127.0.0.1

检查下是否成功运行

netstat -anp | grep 11211

然后安装memcached php扩展客户端

先安装libmemcached

mkdir -p ~/install/libmemcached
cd ~/install/libmemcached
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

tar zxf libmemcached-1.0.18.tar.gz

cd libmemcached-1.0.18

./configure --prefix=/usr/lib/memcached
make && make install

 

然后是php-memcached

mkdir ~/install/php-memcached

cd ~/install/php-memcached

wget https://pecl.php.net/get/memcached-3.0.4.tgz

tar zxf memcached-3.0.4.tgz

cd memcached-3.0.4

/usr/local/php/bin/phpize 

./configure --with-php-config=/usr/local/php/bin/php-config  --with-libmemcached-dir=/usr/lib/memcached

make && make install
cd /usr/local/php/conf.d

echo 'extension=memcached.so' > memcached.ini

service php-fpm restart

检查安装好了没:

php -m | grep memcached

 


 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注