centos7 安装memcached以及扩展

安装memcached

yum install memcached


启动 memcached

/usr/bin/memcached -d -m 64M -u root -l 192.168.1.118 -p 11211 -c 256 -P /tmp/memcached.pid

查看进程

ps  -aux |grep memcached

使用memcached

yum install telnet

telnet  192.168.1.118 11211


测试

set runoob 0 900 9
memcached
STORED

get runoob
VALUE runoob 0 9
memcached

wget http://pecl.php.net/get/memcache-2.2.7.tgz               
tar -zxvf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
END

恭喜你memcached安装成功了.

memcached 扩展

PHP 连接 Memcached 服务

PHP memcache 扩展包下载地址:http://pecl.php.net/package/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
(如果make失败,yum install -y zlib.x86_64 zlib-devel.x86_64)


修改php文件

vi /etc/php.ini

添加

extension = memcache.so

重启 apache
systemctl restart httpd.service #重启apache


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值