ubuntu下安装php redis

sudo apt-get install redis-server

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

下载phpredis
sudo wget http://open.imop.us/pr.tar.gz

tar zxvf pr.tar.gz

cd phpredis

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

如果没有phpize,则需要先安装php5-dev

./configure

make

make install

修改php.ini文件
extension=redis.so

重启apache

 

demo:

$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello world!');
echo $redis->get('test');



相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-05-14
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2021-05-16
  • 2021-09-11
  • 2021-10-03
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
相关资源
相似解决方案