1. First go to GitHub website to download https://github.com/dmajkic/redis/downloads;
2. According to the actual situation, the content of the 64bit CP to the custom drive directory, such as D:\Redis;
3. Open cmd,cd/d Switch to Redis-server.exe directory, run Redis-server.exe redis.conf;
4. At this time another cmd window, the original do not close, otherwise you will not be able to access the server.
Switch to Redis directory to run Redis-cli.exe-h 127.0.0.1-p 6379 (-a password remote);
5. Set the key value pair set MyKey ABC
Remove the key value pair get MyKey;
At this time, the server and client of Redis are running successfully under the Windows environment.
----------------------We install the Redis extension in PHP--------------------
1. Use the Phpinfo () function to view PHP version information, which will determine the extension file version (especially note that the PHP version of architecture is x86 or 64, not the operating system);
2. According to the PHP version number, the compiler version number and CPU architecture
:
http://windows.php.NET/downloads/pecl/snaps/redis/2.2.5/
Http://windows.php.net/downloads/pecl/releases/igbinary/1.2.1/
It seems that the igbinary can not.
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
(Igbinary.dll can not add)
5. After restarting Apache, use Phpinfo to see if the extension was installed successfully;
When testing, the Redis server and the client need to be running!
----------------Yii2 Installing the Redis extension-----------------
1. First, under the Composer.json file, add
"Yiisoft/yii2-redis": "~2.0.0",
Then composer update updates.
2. In the config/main.php configuration file, add
3. In the controller, you can test
Yii:: $app->redis->set (' user ', ' AAA ');
Yii:: $app->redis->set (' user2 ', ' BBB ');
Yii:: $app->redis->set (' User3 ', ' CCC ');
Yii:: $app->redis->set (' user4 ', ' ddd ');
Yii:: $app->redis->get (' user ');//Can output AAA at this time
Yii:: $app->redis->flushall ();//delete all data in Redis
Php5.6+redis+windows7 installation (Phpstudy)