3 回答
TA贡献1841条经验 获得超3个赞
1、php redis
2、解压安装并进入redis目录
[raykaeso@web ~]$ tar xzf redis-2.2.5.tgz
[raykaeso@web ~]$ cd redis-2.2.5
3、在redis文件夹下,生成configure配置文件
[raykaeso@web redis-2.2.5]$ /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[raykaeso@web redis-2.2.5]$ ./configure –with-php-config=/usr/local/php/bin/php-config
[raykaeso@web redis-2.2.5]$ make
[raykaeso@web redis-2.2.5]$ make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
cp: cannot create regular file `/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/#INST@6338#': Permission denied
make: *** [install-modules] Error 1
注意:一定要用root用户。
[raykaeso@web redis-2.2.5]$ su
Password:
[root@web redis-2.2.5]# make install
4、在php配置文件php.ini里面加载redis扩展
extension=redis.so
5、查看phpinfo,redis扩展是否加载
redis
Redis Support enabled
Redis Version 2.2.5
至此,redis扩展已经安装成功并加载,可以用php操作redis了。
TA贡献2016条经验 获得超9个赞
用命令进行测试啊,下面是步骤:
Linux代码
$ /usr/local/webserver/redis/bin/redis-server /etc/redis/redis.conf
$ /usr/local/webserver/redis/bin/redis-cli set foo bar
//输出内容
OK
$ /usr/local/webserver/redis/bin/redis-cli get foo
//输出内容
"bar"
命令行连接:
/usr/local/webserver/redis/bin/redis-cli -h 192.168.1.112 -p 6379
- 3 回答
- 0 关注
- 698 浏览
添加回答
举报