Installing and using Redis under Windows

Source: Internet
Author: User
Tags install redis

One, install Redis

1. Download the installation package

https://github.com/MSOpenTech/redis/releases/

Select a latest version Redis-2.8.19.zip

2. Extract to a specific directory

D:\redis-2.8.19

3. In the cmd window, go to the specified directory and start the service using the following command

Redis-server.exe redis.windows.conf

4. Double hit Open redis-cli.exe, if not error, even on the local server, test the Set,get command

127.0.0.1:6379> Set Key test
Ok
127.0.0.1:6379> Get key
"Test"

Second, install the Redis extension

1. Download the installation package, note the version used

Https://github.com/phpredis/phpredis/downloads

If you don't have the version you want, you can go to this link to see

http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/

2. Put the downloaded Php_igbinary.dll,php_redis.dll in the PHP extension directory (EXT)

3. Modify the configuration file php.ini (add Extension=php_igbinary.dll,Extension=php_redis.dll, and Extension=php_igbinary.dll PHP will report an error before you put it in Extension=php_redis.dll )


4. Restart the service, view Phpinfo () to find out if the Redis extension is successfully installed

Third, use the PHP connection test

$redis = new Redis(); $redis ->connect( "127.0.0.1" , "6379" );  $redis ->set( "say" , "Hello World" ); echo "<br/>" . $redis ->get( "say" );   $array = array ( ‘first_key‘ => ‘first_val‘ , ‘second_key‘ => ‘second_val‘ , ‘third_key‘ => ‘third_val‘ ); $array_get = array ( ‘first_key‘ , ‘second_key‘ , ‘third_key‘ ); $redis ->mset( $array ); echo "<br/>" ; print_r( $redis ->mget( $array_get ));

Installing and using Redis under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.