redis的php客户端安装
1.下载phpredis
https://github.com/nicolasff/phpredis
2.解压文件
unzip phpredis-master.zip
3.安装
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
4.修改php.ini配置文件(vi /etc/php.ini)
加入一行:
extension=/home/lengzijian/downloads/phpredis-master/modules/redis.so(可以放在方便的位置)
5.重启apache或者nginx
/etc/init.d/httpd restart
6.查看phpinfo
7.编写测试代码
<?php$redis = new Redis();$redis->connect('127.0.0.1',6379);$redis->set('name','lenzijian');echo $redis->get('name');?>