1. Use the Phpinfo () function to view PHP version information, which will determine the extension file version.
2. Download Php_igbinary-2.0.1-7.0-ts-vc14-x64.zip,php_redis-3.1.3rc2-7.0-ts-vc14-x64.zip (be sure to make sure the version is correct)
: "Select the appropriate version"
http://windows.php.net/downloads/pecl/snaps/redis/
http://windows.php.net/downloads/pecl/releases/igbinary/
PS: If you see Php7ts.dll in the PHP directory, select the TS version
3. After decompression, copy the Php_redis.dll and php_redis.pdb to the PHP ext directory
4. Modify the PHP.ini, (PS: This php.ini file is in the Apache directory) to include in the file:
; Php_redis
Extension=php_igbinary.dll
Extension=php_redis.dll
Note: Extension=php_igbinary.dll must be placed in front of extension=php_redis.dll, otherwise this extension will not take effect
5. After restarting Apache, use Phpinfo to see if the extension was installed successfully
6. After you open the Redis service, you can test whether it can be called with the following.
<?php //Connect the local Redis service $redis = new Redis (); $redis->connect (' 127.0.0.1 ', 6379); echo "Connection to Server sucessfully"; Set up Redis string data $redis->set ("Tutorial-name", "Redis Tutorial"); Get the stored data and output echo "Stored string in Redis::". $redis->get ("Tutorial-name");?>
PS: The local Redis service must be turned on before running ": Https://redis.io/download"
In fact, Redis can be installed as a Windows service, boot from boot, the command is as follows:
Redis-server--service-install redis.windows.conf
Once installed, you can see that Redis is already a Windows service:
But after the installation, Redis did not start,
The start command is as follows:
Redis-server--service-start
Stop command:
Redis-server--service-stop
You can also install multiple instances
Redis-server--service-install–service-name redisservice1–port 10001redis-server--service-start–service-name Redisservice1redis-server--service-install–service-name redisservice2–port 10002redis-server--service-start– Service-name redisservice2redis-server--service-install–service-name redisservice3–port 10003redis-server-- Service-start–service-name RedisService3
Uninstall command:
Redis-server--service-uninstall
Installing Redis Extensions for PHP under Windows