安装phpredis模块
https://github.com/owlient/phpredis
下载phpredis
解压
shell> cd phpredis
shell> /usr/local/php/bin/phpize 这个phpize是安装php模块的
shell> ./configure --with-php-config=/usr/local/php/bin/php-config
shell> make
shell> make install
接下来在php.ini中添加extension=redis.so 先要看看有没有extension_dir=/.......
重启apache或者nginx
php代码测试
<?php
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello world!');
echo $redis->get('test');
?>