centos6 php7 安装 memcache 和 memcached
-
下载安装memcache
注意:官网的memcache包,暂时好像不支持php7。所以到下面地址下载memcache包,切换到php7分支
# 下载
wget https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
# 解压
unzip php7.zip
cd pecl-memcache-php7
# 编译
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
# 安装
make
make install
# 生成memcache.so文件后,在php.ini文件添加
extension=memcache.so
# 重启php-fpm即可
-
服务端安装memcached
# 安装
yum install memcached
启动
/usr/bin/memcached -d -m 256 -u root -p 11211 -c 1024 –P /tmp/memcached.pid
-
安装memcached之前。先要安装libmemcached
直接yum安装的,在安装memcached的时候,会导致出错。具体原因不知道。可能还是php7的原因
yum install libmemcached libmemcached-devel
libmemcached源码包
# 安装依赖
yum install install gcc+ gcc-c++
# 下载
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/local/libmemcached --with-memcached
# 安装
make
make install
-
客户端安装memcached
注意:和memcache一样,官网的memcachde包,暂时好像不支持php7。所以到下面地址下载memcached包,切换到php7分支
github下载地址
官网memcached下载地址
# 下载memcached
wget https://github.com/php-memcached-dev/php-memcached/archive/php7.zip
# 解压
unzip php7.zip
cd php-memcached-php7
# 编译
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ --disable-memcached-sasl
# 安装
make
make install
# php.ini 添加拓展。重启php-fpm生效
extension=memcached.so