Redis的php扩展phpredis安装小记

最近这段时间一直在捣鼓Redis,捣鼓了蛮长一段时间了,略有所感就记录下来了。

老的文章在这里:http://www.cnblogs.com/scotoma/archive/2010/12/05/1897067.html

这里主要是写Redis在PHP下的扩展,原来打算在生产环境下使用PHP 5.3.4 可是感觉PHP官方都不是很推荐使用PHP 5.3.*的功能,新的Zend Framework2.0 更是没有咋继续更新了,所以就退回到了 5.2.16了.

为什么用Redis就不用说了,退回了5.2.16版本后就不打算继续使用Predis了就上Redis的官网看了下,感觉改版很大,换了独立的域名了,由VMware支持后果然不一样,新域名如下:http://redis.io/

看了新的Tutorials发现非常不错,推荐去看看:http://try.redis-db.com/

现在这里主要讲下phpredis扩展的安装,这个扩展是C写的,性能上看应该比Predis要好多了,安装后用起来感觉不错

安装步骤如下:

1.download code :git clone https://github.com/owlient/phpredis.git
2.phpize
(if you use centos,u should use the full path
/usr/local/php/bin/phpize
)./configure
(if get error ,should change it to
 ./configure --with-php-config=/usr/local/php/bin/php-config
)make && make install
3.edit php.ini and add extension
extension=redis.so
4.restart u server
结果以上几步安装完成后就可以出现这个了,查看phpinfo

安装完成后开始使用了

使用说明文档在这里:

https://github.com/owlient/phpredis

测试代码在这里:

dump:

string(11) “Hello world” string(9) “xinqiyang”

update:20110721

原文地址:https://www.cnblogs.com/scotoma/p/1921283.html