php扩展redis
Posted Liuyt
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php扩展redis相关的知识,希望对你有一定的参考价值。
![](https://image.cha138.com/20210612/52bf145f961d4a87aacbf26939d06549.jpg)
2、根据自己PHP信息,选定下载的redis扩展版本
![](https://image.cha138.com/20210612/df3c648e541f4872a97498405808fd0d.jpg)
![](https://image.cha138.com/20210612/78cacfcb56f54420bbe8e95473534567.jpg)
![](https://image.cha138.com/20210612/7cd6cc92bef7486384a5cfe042dbc00a.jpg)
3、将放到php扩展目录
![](https://image.cha138.com/20210612/d9885de610974cb283fb1bb0a132641e.jpg)
![](https://image.cha138.com/20210612/acc0821d44af456693d3113c3947a945.jpg)
4、修改php.ini文件,添加extension=php_redis.dll
![](https://image.cha138.com/20210612/368fb4e2551a4660b872a61ccec625dd.jpg)
5、重启apache,查看phpinfo中是否有Redis扩展,如果重启失败,请查看选择redis版本是否正确。
![](https://image.cha138.com/20210612/49e8eaa3543446afa6147ffac239c7b1.jpg)
5、php测试连接redis代码
备注:阿里云redis必须是阿里云的ECS才能连接,属于内网连接,阿里云redis连接密码为【实例ID:密码】
<?php $redis = new \\Redis(); $redis->connect(\'127.0.0.1\',6379); //进行密码验证 $redis->auth(\'我的密码\'); $redis->set(\'test\',\'hello world!\'); echo $redis->get("test");
以上是关于php扩展redis的主要内容,如果未能解决你的问题,请参考以下文章