PHP头条
热点:

ubuntu上安装phpredis


ubuntu下安装php redis

ubuntu下安装php redis

?

1.安装redis服务端

sudo apt-get install redis-server

测试redis是否安装成功:
注意:要开启redis
redis-cli
set myname wangking
OK
get myname
"wangking"

?

2.下载安装redis的php扩展插件,phpredis。
sudo wget http://open.imop.us/pr.tar.gz

tar zxvf pr.tar.gz

cd phpredis

phpize //这个phpize是安装php模块的

如果没有phpize,则需要先安装php5-dev (apt-get install php5-dev)

./configure

make

sudo make install

修改php.ini文件(/etc/php5/apache2/php.ini)
extension=redis.so

重启apache (sudo /etc/init.d/apache2 restart)

?

php test demo:

$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('myname','wangking');
echo $redis->get('test');

?

?

?

www.phpzy.comtrue/phprm/41869.htmlTechArticleubuntu上安装phpredis ubuntu下安装php redis ubuntu下安装php redis ? 1.安装redis服务端 sudo apt-get install redis-server 测试redis是否安装成功: 注意:要开启redis redis-cli set myname wangking OK get myname "wangk...

相关文章

PHP之友评论

今天推荐