安装Memcached和Memcached PHP扩展

Memcached资源很容易混淆,所以我打包好了.
下载地址: http://www.euphie.net/downloads/memcached.tar.gz
下载后解压,里面有几个包:
1.memcached-1.4.15 //Memcached服务端.
2.memcached-2.1.0 //PHP的Memcached扩展,其实Memcached扩展有两种,还有一种叫Memcache,不过Memcached比Memcache功能更强大.
3.libevent-2.0.21-stable //Memcached服务端的依赖包.
4.libmemcached-1.0.16 //Memcached扩展的依赖包.

一,安装Libevent

#cd libevent-2.0.21-stable
#./configure -prefix=/usr/local/libevent
#make
#make install

二,安装Memcached服务端

#cd memcached-1.4.15
#./configure -prefix=/usr/local/memcached 
-with-libevent=/usr/local/libevent
#make
#make install

三,启动Memcached服务

#/usr/local/memcached/bin/memcached -d -m 50 
-u root -p 12000 -c 256 -P /tmp/memcached.pid

注:
-d选项是启动一个守护进程,
-m是分配给Memcache使用的内存数量,单位是MB.
-u是运行Memcache的用户.
-l是监听的服务器IP地址,我这里没有填.
-p是设置Memcache监听的端口.
-c选项是最大运行的并发连接数,默认是1024,按照你服务器的负载量来设定.
-P是设置保存Memcache的pid文件.

四,安装Libmemcached

#cd libmemcached-1.0.16
#./configure -prefix=/usr/local/libmemcached 
-with-memcached=/usr/local/memcached/bin/memcached
#make
#make install

注:
如果报”./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directory”错误,则需要升级gcc版本.

五,安装Memcached PHP扩展

#cd memcached-2.1.0
找到phpize和php-config的路径,我的分别是/usr/local/bin/phpize和/usr/bin/php-config.
#/usr/local/bin/phpize
#./configure --with-php-config=/usr/bin/php-config 
--with-libmemcached-dir=/usr/local/libmemcached
#make
#make install
安装成功后会生成memcached.so,把路径加到php.ini的extension=xxx里.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值