首页 > Web开发 > 详细

安装redis和phpredis模块

时间:2014-03-22 15:40:50      阅读:517      评论:0      收藏:0      [点我收藏+]

安装redis

shell> wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz
shell> tar zxvf redis-2.0.4.tar.gz
shell> mv redis-2.0.4 redis
shell> cd redis
shell> make
shell> redis-server 不要关
shell> redis-cli
redis>set foo bar
OK
redis>get foo
"bar"
 
安装phpredis模块
https://github.com/owlient/phpredis
下载phpredis
解压
shell> cd phpredis
shell> /usr/local/php/bin/phpize      这个phpize是安装php模块的
shell> ./configure --with-php-config=/usr/local/php/bin/php-config
shell> make
shell> make install
接下来在php.ini中添加extension=redis.so   先要看看有没有extension_dir=/.......
重启apache或者nginx
 
php代码测试
<?php
$redis = new Redis();
$redis->connect(‘127.0.0.1‘,6379);
$redis->set(‘test‘,‘hello world!‘);
echo $redis->get(‘test‘);
?>
扩展阅读:http://blog.sina.com.cn/s/blog_6cfe25850101flga.html

安装redis和phpredis模块,布布扣,bubuko.com

安装redis和phpredis模块

原文:http://www.cnblogs.com/jamesbd/p/3617352.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!