[转载]在Windows下为PHP5.6安装redis扩展和memcached扩展

一.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

下载地址:

https://windows.php.net/downloads/pecl/releases/redis/2.2.5/

 
 

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

 
 

4.修改php.ini

 

在该文件中搜索extension列表,加入这两个扩展

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

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

 

6. 要在Windows中使用redis需要下载Windows版的redis软件

新建一个test.php页面

<?php
    $redis = new Redis();
    $redis->connect('127.0.0.1',6379);
    $redis->set('test','hello redis');
    echo $redis->get('test');
 
 

二.php安装memcache扩展

windows 7 64bit 环境下安装memcached
1、下载后解压到D:\memcached(下载地址:memcached-win64下载地址)
 
 
2、安装到windows服务,打开cmd命令行,进入memcached目录,执行:memcached -d install命令,安装服
如果在没有安装过的情况下,出现"failed to install service or service already installed"错误,则是cmd.exe需要用管理员身份运行。
 
 
3.启动服务,执行:memcached -d start
 
4. 安装PHP Memcache扩展
    下载正确版本的php_memcache.dll动态链接库文件 ,并放在php5.6.16\ext目录下 。
5.编辑php.ini,添加下面一行代码到php.ini文件中。
    extension=php_memcache.dll
6.在phpinfo中查看memcache扩展是否安装成功。
 
posted @ 2018-04-12 21:29  北七星  阅读(611)  评论(0编辑  收藏  举报
F**k me on Gitee