I. Pre-installation must read
Windows 64-bit operating system
Redis installation Package (version 3.0.5, as of 2017-05-29, the latest Redis version is 3.2.9)
Precautions:
1. Under window If you still need to install the Redis extension for PHP, then installing the latest version of Redis may not have a corresponding Php_redis. DLL;
2. The online installation of Redis and PHP extensions for Windows is mostly redis2.x version, which may not be applicable for the installation of high version;
3. At first I installed the latest version of redis3.2.9, in the installation of Php_redis development dumbfounded, Php_redis.dll did not find redis3.2 version, at least I spent a long time also did not find, tat!
Take a look at the 2017-05-29, downloadable version of Php_redis.dll, website link https://pecl.php.net/package/redis
Take a look at the version of Redis under the cutoff 2017-05-29,windows, git address https://github.com/MSOpenTech/redis/releases
See, Windows has redis3.2 version, but not good to find redis3.2 corresponding Php_redis.dll, so it is recommended that you choose the Redis version should pay attention to the corresponding Php_redis expansion can also be found!
Two. Installing Redis
1. Download Redis compression pack, githttps://github.com/msopentech/redis/releases
Here I choose 3.0.5 version, select Zip download
2. After downloading, unzip to Redis folder, the following is the extracted files, the installation is complete
Redis-cli.exe # Client
Redis-server.exe # Server
REDIS.WINDOWS.CONF # configuration file
3.redis Test
Windows run (shortcut key: Windows key +r), enter "cmd" command, enter the DOC operating system window;
Accessing the Redis installation directory using commands
[OBJC]View PlainCopy
- Redis-server redis. Windows. conf
Start Redis Service, this window does not need to close, close the window to stop the Redis service, start successfully such as:
Open a new Doc window, go to the installation directory to execute the client startup command "REDIS-CLI" or simply double-click Redis-cli.exe to test the command, create and get the name value Leesin data:
Three. Installing the Redis Extension for PHP
1. Download Php_redis.dll,https://pecl.php.net/package/redis
I chose version 3.0.0, which corresponds to the Redis installation version 3.0
Select the corresponding download in the newly opened window and view the Phpinfo information first.
So here I choose the 64-bit NTS version of the download
2. Locate the PHP installation directory and put the two files in the downloaded package into the Ext folder.
3. Modify PHP.ini Add
extension=php_redis.dll
Open Redis Extension, save and restart Nginx or Apache server
4. Verify that Redis expansion is turned on
Review the Phpinfo information again and search for Redis, which means it is open successfully.
5.php Connect and test the Redis database
New test.php
[PHP]View PlainCopy
- <?php
- $redis = new Redis ();
- $redis->connect (' 127.0.0.1 ', 6379);
- $redis->set (' name ',' leesin ');
- echo $redis->get (' name ');
- ?>
Visit test.php
Output Leesin
At this point, you are all done with Redis and PHP expansion installation under Windows!
Redis development tutorial for Redis and PHP under Windows installation