centos6 php7 安装 memcache 和 memcached

  • 下载安装memcache

注意:官网的memcache包,暂时好像不支持php7。所以到下面地址下载memcache包,切换到php7分支

php7 memcache github 下载地址

官网下载地址

# 下载
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值