Redis is now more popular NoSQL, mainstream large sites are used more, many students do not know how to install, here is introduced in Windows installation and extension, provide learning to use, the actual use of the environment more under Linux.
First download Redis on the appropriate website:
Unzip to any disk after download is complete such as: D:/redis
Inside includes:.
Redis-server.exe: Service Program
Redis-check-dump.exe: Local Database check
Redis-check-aof.exe: Update log check
Redis-benchmark.exe: Performance test to simulate the simultaneous sending of M-Sets/gets queries by n clients (similar to the Apache AB tool).
Of course, also need a: redis.conf (specific content on-line random search will have)
To start Redis:
Enter the root directory of Redis with the cmd command,
Input command: Redis-server.exe redis.conf
After startup:
Start the cmd window to remain open, and the Redis service shuts down when it is closed.
- 3
When the service is opened, another window is opened, and the client is set up:
Input command: redis-cli.exe-h 192.168.2.168-p 6379 (this IP is self-setting, 6379 is the Redis default port)
After input:
- 4
Installing the Redis Extension
First, look at the PHP compiled version v6/v9 in Phpinfo ()
- 5
Go to the appropriate website to download the Redis extension:
Download the corresponding version of the Redis extension
- 6
Place the downloaded Php_redis.dll in the PHP extension directory (EXT) and modify the configuration file php.ini
When adding extensions, be sure to
Extension=php_igbinary.dll
Extension=php_redis.dll
This order
- 7
Restart the service, view Phpinfo (), appear to indicate success;
- 8
PHP code test
$redis = new Redis ();
$redis->connect ("192.168.138.2", "6379"), //php client-set IP and port
/ /store a value
$redis->set ("Say", "Hello World"),
echo $redis->get ( "Say"); //should output Hello World
//store multiple values
& nbsp $array = Array (' first_key ' = ' first_val ',
' Second_key ' =& gt; ' Second_val ',
' third_key ' = ' third_val ');
$array _get = Array (' First_key ', ' second_key ', ' Third_key ');
$ Redis->mset ($array);
Var_dump ($redis->mget ($array _get);
end
Redis compilation installation under Windows