phpstudy 7.2.1 -nts install redis extension

Copyright: Original article reproduced please indicate the source https://blog.csdn.net/LQZ8888/article/details/90700255

   

Check your PHPinfo information

 

 

Find a relatively deserve Redis extension Download: http://pecl.php.net/package/redis

I was x86, vc15

 Download and extract the good, and copy php_redis.dll and php_redis.pdb

 

 Paste the PHPstudy of the PHP ext next (pay attention to your PHP version number)

 

 Then go on to add php.ini extension = php_redis.dll

 

 

 

 Then restart PHPstudy, go PHPinfo View

 OK completed


 

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

Redis installed

Under Window Installation

Download: https://github.com/MSOpenTech/redis/releases .

Redis supports 32-bit and 64-bit. This according to the actual circumstances of your system platform selection, here we download  Redis-x64-xxx.zip archive to the C drive, unzip the folder renamed  Redis .

Open the folder, as follows:

打开一个 cmd 窗口 使用 cd 命令切换目录到 C:\redis 运行:

redis-server.exe redis.windows.conf

如果想方便的话,可以把 redis 的路径加到系统的环境变量里,这样就省得再输路径了,后面的那个 redis.windows.conf 可以省略,如果省略,会启用默认的。输入之后,会显示如下界面:

Redis 安装

这时候另启一个 cmd 窗口,原来的不要关闭,不然就无法访问服务端了。

切换到 redis 目录下运行:

redis-cli.exe -h 127.0.0.1 -p 6379

设置键值对:

set myKey abc

取出键值对:

get myKey

Redis 安装

 

 

下面可以去测试试一试:

 

<?php

$redis = new Redis(); //实例化这个类

$redis->connect('127.0.0.1', 6379); //指定主机和端口进行连接

$redis->set('myname', 'mclink'); //设置键值对

$res = $redis->get('myname'); //获取值

echo "我设置的myname键的值为:".$res; //打印输出

Linux 下安装

下载地址:http://redis.io/download,下载最新稳定版本。

本教程使用的最新文档版本为 2.8.17,下载并安装:

$ wget http://download.redis.io/releases/redis-2.8.17.tar.gz
$ tar xzf redis-2.8.17.tar.gz
$ cd redis-2.8.17
$ make

make完后 redis-2.8.17目录下会出现编译后的redis服务程序redis-server,还有用于测试的客户端程序redis-cli,两个程序位于安装目录 src 目录下:

下面启动redis服务.

$ cd src
$ ./redis-server

注意这种方式启动redis 使用的是默认配置。也可以通过启动参数告诉redis使用指定配置文件使用下面命令启动。

$ cd src
$ ./redis-server ../redis.conf

redis.conf 是一个默认的配置文件。我们可以根据需要使用自己的配置文件。

启动redis服务进程后,就可以使用测试客户端程序redis-cli和redis服务交互了。 比如:

$ cd src
$ ./redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

Ubuntu 下安装

在 Ubuntu 系统安装 Redis 可以使用以下命令:

$sudo apt-get update
$sudo apt-get install redis-server

启动 Redis

$ redis-server

查看 redis 是否启动?

$ redis-cli

以上命令将打开以下终端:

redis 127.0.0.1:6379>

127.0.0.1 是本机 IP ,6379 是 redis 服务端口。现在我们输入 PING 命令。

redis 127.0.0.1:6379> ping
PONG

以上说明我们已经成功安装了redis。

Guess you like

Origin blog.csdn.net/LQZ8888/article/details/90700255