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');
相关推荐
savorTheFlavor 2020-10-23
Noneyes 2020-11-10
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23