How to install redis extension in php7.0

藏色散人
Release: 2023-02-17 20:36:01
Original
2995 people have browsed it

php7.0安装redis扩展的方法:首先查看自己PHP的版本;然后下载并解压redis;最后在php.ini文件中添加“extension=php_redis.dll”即可。

How to install redis extension in php7.0

本文操作环境:windows7系统、PHP7.0版,DELL G3电脑

1、查看自己PHP的版本

echo phpinfo()
Copy after login
查看自己的版本:


VC是14,系统是64位的,所以一定要选对版本,因为这个版本我折腾了好久。

2、根据自己的PHP版本、编译器的版本以及cpu
我的是php是7.0 、VC14、X64。附上我的下载链接redis、igbinary的链接:
Redis:
http://windows.php.net/downloads/pecl/releases/redis/
Copy after login
:
Copy after login
; php_redis extension=php_igbinary.dll extension=php_redis.dll
Copy after login

注意:extension=php_igbinary.dll一定要放在在extension=php_redis.dll的前面,否则扩展失败!!!

5、再次实行步奏1,全文搜索Redis如图:

安装扩展成功,接下来可以简单测试一下!

6、简单测试是否可以启动服务:


connect('127.0.0.1',6379); echo "Connection to server successfully"; //查看服务是否运行 echo "server is running:".$redis->ping();
Copy after login

运行结果如图:

链接成功!

7、存取一下数据

connect('127.0.0.1',6379); //echo "Connection to server successfully"; //查看服务是否运行 //echo "server is running:".$redis->ping(); //选择数据库 $redis -> select(2);//设置 key$redis -> set('weather','sun'); $redis -> set('test','good');var_dump($redis -> get('test'));var_dump($redis -> get('weather'));?>
Copy after login

运行结果如图:

8、为了更加直观,我又下载了RedisClient:

打开可视化界面,输入如下信息:

因为没有设置密码所以不用填写。

我们刚才是往数据库db2中添加的数据,所以打开查看一下:

已经存在数据库中。有了可视化界面,我们可以直接在这里添加数据。

补充:视图中有个语言(
language),可以切换中文和英文!



继续学习探索中...

Copy after login

language

The above is the detailed content of How to install redis extension in php7.0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!