php redis安装使用

 

下载redis-windows-master。解压点击redis-server.exe运行服务端php

 

redis设置访问密码redis

修改redis.conf文件配置, # requirepass foobared去掉注释,foobared改成本身的密码windows

默认端口6379架构

 

 

安装redis扩展函数

使用phpinfo()函数查看PHP的版本信息,这会决定扩展文件版本ui

根据PHP版本号,编译器版本号和CPU架构,.net

选择php_redis-2.2.5-5.5-ts-vc11-x86.zip和php_igbinary-1.2.1-5.5-ts-vc11-x86.zipserver

下载地址:blog

http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/ip

http://windows.php.net/downloads/pecl/releases/igbinary/1.2.1/

 

 

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

 

四、修改php.ini

extension=php_igbinary.dll

extension=php_redis.dll

注意:extension=php_igbinary.dll必定要放在extension=php_redis.dll的前面,不然此扩展不会生效

重启Apache后,使用phpinfo查看扩展是否成功安装.搜igbinary和redis能搜到表示安装完成。

 

五、新建一个test.php页面

<?php

 $redis=new Redis();

 $redis->connect('192.168.1.11',6379);

 $redis->auth('123456');

 $redis->set('test','helloworld');

$redis->setex('test2',10,$str.'---2');//设置带时间的参数10秒

 echo $redis->get('test');

 echo $redis->get('test2');

相关文章
相关标签/搜索