The configuration and description of php to extend redis under windows

Operating prerequisites

Windows must have the redis service installed and enabled.
If not, please click to view

Summary

In total, we have to do four steps

first step

Check out phpconf() for yourself.

write picture description here

second step

There are two files to download
igbinary,
click to download

Download the corresponding version
write picture description here
and put the two red files in the compressed file into the php ext directory.
write picture description here

third step

Download the phpredis extension
Click
Download to download the corresponding version, x86 or x64

Also put the two files in the php ext directory
write picture description here

third step

Add two lines to php.ini:

extension=php_igbinary.dll
extension=php_redis.dll

Then check whether the redis extension is included in phpinfo.
If it is extended, it can be used directly as a new object.

//实例化redis
    $redis = new Redis();
    //连接
    $redis->connect('127.0.0.1', 6379);
    //检测是否连接成功
    echo "Server is running: " . $redis->ping();
    // 输出结果 Server is running: +PONG

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326214202&siteId=291194637