redis&memcached for windows 安装与使用

redis for windows

很简单只须要3步,主要是安装redis和安装php的redis扩展两个方面(安装玩以后应该进行必定配置php

1.Windows安装包下载地址:https://github.com/ServiceStack/redis-windows(注意,不少地址是linux的安装包,没有exe文件) https://github.com/mythz/redis-windowshtml

windows安装redis,推荐博客:http://www.cnblogs.com/xshang/p/3800205.html,我按照次安装成功。linux

2.去下载php相应版本的dell文件, 安装extension=php_igbinary.dll扩展, 放入php的ext目录下git

3.配置php:(注意保持这个顺序)
extension=php_igbinary.dll
extension=php_redis.dllgithub

成功,查看phpinfo()信息。redis

--------------------------------建议使用如下安装方法将redis安装为服务,而后设置自启动windows

1,在redis的目录下执行(执行后就做为windows服务了)memcached

redis-server --service-install redis.windows.conf

2,安装好后须要手动启动redis测试

redis-server --service-start

3,中止服务spa

redis-server --service-stop

4,卸载redis服务

redis-server --service-uninstall

//--------------详细步骤----------------------------------------------------------------

window下安装redis

       在window下安装redis,首先下载redis,解压放到一个目录下,好比D:\redis\

       在控制台下切换到D:\redix

       输入:redis-server.exe  redis.conf

       而后从新打开一个cmd控制台,仍然切换到D:\redis\下

       输入:redis-cli.exe -h 127.0.0.1 -p 6379

       以后就可使用了,好比继续输入:set test "hello world"

       接着输入 get test

       就会返回 hello world

      --------------------------------------------------------------------------------------------------------

      在php下使用redis,要用到php_redis.dll,下载对应版本,放到php下的ext目录下,而后

      须要配置php.ini,加入extension=php_redis.dll

      在查看须要php_redis哪一个版本时,能够用

      <?php   echo phpinfo(); ?>进行测试

      而后,重启wamp

      再用

      <?php echo phpinfo(); ?>测试

      看到redis时,表示安装成功了

 

memcached for windows

http://www.runoob.com/memcached/window-install-memcached.html下载

一、下载memcache的安装包,要选择win环境的安装包

二、把解压后放到D盘(以D:/memcached为例)

三、点击开始=》运行=》输入cmd进入dos界面。

四、输入 d:  命令进入d盘,输入 cd memcached 命令进入memcached文件夹

五、输入 memcache.exe –d install 命令安装,输入memcache.exe –d start 启动memcached进程。中止命令 memcached.exe -d stop, 卸载命令memcached.exe -d unistall

六、进入任务管理器,查看进程,以下图则安装成功:memcached.exe

七、下载 php_memcache.dll扩展文件,放到wamp安装目录下的bin\PHP\php5.5.12\ext目录下

 

八、打开php.ini,加入 extension=php_memcache.dll ,注意前面没有分号,保存后从新启动服务

九、在本地新建项目memcached,添加index.php执行文件,输入代码以下:

    $memcache=new Memcache();

    $memcache->connect('127.0.0.1',11211);

    $memcache->add('name2','fesfarige',false,60);

    $val=$memcache->get('name2');

    echo $val;

成功则输出fesfarige

e:\phpToStudy\memcached> memcached.exe -m 1 -d start

(2). 中止memcached:

   memcached.exe -d stop

(3). 卸载memcached:

   memcached.exe -d uninstall

相关文章
相关标签/搜索