一.php安装redis扩展
1.使用phpinfo()函数查看PHP的版本信息,这会决定扩展文件版本


2.根据PHP版本号,编译器版本号和CPU架构,
选择php_redis-2.2.5-5.6-ts-vc11-x64.zip和php_igbinary-1.2.1-5.5-ts-vc11-x64.zip
下载地址:
http://windows.php.net/downloads/pecl/releases/redis/2.2.7/
http://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/


3.解压缩后,将php_redis.dll和php_igbinary.dll拷贝至php的ext目录下

4.修改php.ini,在该文件中加入:
; php_redis
extension=php_igbinary.dll
extension=php_redis.dll
注意:extension=php_igbinary.dll一定要放在extension=php_redis.dll的前面,否则此扩展不会生效


5.重启Apache后,使用phpinfo查看扩展是否成功安装

新建一个test.php页面
<?php
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello redis');
echo $redis->get('test');
?>
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello redis');
echo $redis->get('test');
?>
hello redis
6. 要在Windows中使用redis需要下载Windows版的redis软件
7. 在windows中让redis开机自启动:
redis-server --service-install redis.windows-service.conf --loglevel verbose