【其他】wampServer 安装redis扩展
一、查看PHP版本信息
使用 phpinfo() 函数查看 PHP 的版本信息(用于选择扩展包)
![](http://upload-images.jianshu.io/upload_images/147513-ede3fca531bb9bb2.png?imageMogr2/auto-orient/strip|imageView2/2/w/944/format/webp)
↑ PHP版本 5.6.40,编译器版本 Visual C++ 2012,CPU架构 x64
二、根据版本选择扩展包
php_redis.dll 下载地址:https://windows.php.net/downloads/pecl/releases/redis/2.2.7/
php_igbinary.dll 下载地址:https://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/
![](http://upload-images.jianshu.io/upload_images/147513-99812b273227eb2c.png?imageMogr2/auto-orient/strip|imageView2/2/w/977/format/webp)
![](http://upload-images.jianshu.io/upload_images/147513-c1b6923959ddd45c.png?imageMogr2/auto-orient/strip|imageView2/2/w/1009/format/webp)
↑ php_redis-2.2.7(redis版本)-5.6(php版本)-ts(扩展)-vc11(编译器版本)-x64(CPU架构)
三、安装Redis扩展
解压 zip 文件,只保留 php_redis.dll 和 php_igbinary.dll 文件
![](http://upload-images.jianshu.io/upload_images/147513-1733c87147043206.png?imageMogr2/auto-orient/strip|imageView2/2/w/246/format/webp)
将这两个文件拷贝至 [wamp64 安装目录]\bin\php\php5.6.16\ext\ 目录中
![](http://upload-images.jianshu.io/upload_images/147513-5c7d756ff28521fc.png?imageMogr2/auto-orient/strip|imageView2/2/w/703/format/webp)
四、修改 php.ini 配置
![](http://upload-images.jianshu.io/upload_images/147513-34250a0ca782060b.png?imageMogr2/auto-orient/strip|imageView2/2/w/354/format/webp)
↑ wampserver 并不会读取 php 目录下的 php.ini,而是调用的 /apache/bin 目录下的 php.ini 文件
修改 php.ini 在文件中添加:
[redis]
; php_redis
extension=php_igbinary.dll
extension=php_redis.dll
![](http://upload-images.jianshu.io/upload_images/147513-bad61160d18b272c.png?imageMogr2/auto-orient/strip|imageView2/2/w/257/format/webp)
注意:php_igbinary.dll 一定要位于 php_redis.dll 之前
五、查看安装结果
重启 wampserver(restart all server),使用 phpinfo() 函数查看扩展是否安装
![](http://upload-images.jianshu.io/upload_images/147513-a7cdc38fbcc2afe5.png?imageMogr2/auto-orient/strip|imageView2/2/w/761/format/webp)
↑ Redis 扩展安装成功,redis 版本为 2.27
新建一个 php 文件测试 redis 扩展是否可用
connect('127.0.0.1', 6379);echo'
Redis Server Connect Success
';$redis->set('test', 'Hello Redis');echo$redis->get('test');
![](http://upload-images.jianshu.io/upload_images/147513-707557d9135f47d5.png?imageMogr2/auto-orient/strip|imageView2/2/w/308/format/webp)
↑ wampserver redis 扩展安装成功
相关资料:
欢迎关注我,一起进步!扫描下方二维码即可加我QQ
![](https://www.cnblogs.com/images/cnblogs_com/websmile/1492407/t_smile%E8%BD%AC%E8%A7%92.jpg)