1.安装 PHP 扩展模块
tar zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
cd owlient-phpredis-90ecd17
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config make && make install
2.修改
PHP 配置文件 vi /usr/local/php/etc/php.ini extension=redis.so
3.重启
apache/usr/local/apache2/bin/apachectl restart
<?php
$redis=new Redis();
$redis->connect('127.0.0.1',6379); //连接
$redis->auth('youpassword'); //如果没有配置密码,则不需这步
$redis->set('test','hello redis');
echo $redis->get('test');