WINDOWS32-bit installation redis+ connection PHP

Source: Internet
Author: User
Tags download redis phpinfo vc9 redis server

Download Redis's windows32-bit client: http://pan.baidu.com/s/1ntA2PQx

After downloading, it is recommended to extract to the Web directory, such as: D:\WWW\Redis

In order to avoid the trouble of using CMD to enter the folder can be directly into your Redis folder shift+ right mouse button (such as the right image)

Then enter the following instruction (redis.conf is a redis configuration file, which can be modified after the operation, which I copy from the Internet to change to be able to use):

If you can see cmd displaying the following, congratulations, your Redis server is ready to use:

In the future you can use this command to open Redis, of course, Windows can not be closed, close the window Redis will stop running.

Then, create a PHP-to-redis connection so that PHP can send data directly to Redis:

Please run phpinfo () to see the following: PHP version number, TS or NTS, VC version

Please select the corresponding version of the DLL download

PHP5.4-TS-VC9 (xampp with this)

PHP5.3-TS-VC9 (Wamp's general use of this)

After downloading, please copy the extracted DLL files to the Php/ext directory, for example, my is d:\xampp\php\ext,wamp the moment can't think of the specific path, please search the folder directly. (Note: PHP5.4 need two to use together, so I have two DLLs)

Then you modify the php.ini, and after you see a lot of Extension=xxxxx.dll, add the following content (to get Apache to load the corresponding extension at boot time):

PHP5.4: (Note: The order cannot be reversed)

Extension=php_igbinary.dll
Extension=php_redis.dll

PHP5.3: (Use Wamp note, look at your phpinfo in the loaded Configuration file field php.ini The real call path, by default php.ini is loaded Apache under the php.ini)

Extension=php_redis.dll

After the field is added to save restart Apache (do not restart is not loaded), and then look at your phpinfo inside is not able to search the Redis extension, if found that congratulations, extension loading success can then next, if not found also congratulate you, back to check which step out of the problem. (, different version can not tangle)

End, test:

Create a new PHP file, enter the code

<?php    $redis = new Redis ();    $redis->connect (' 127.0.0.1 ', 6379);  The PHP client sets the IP and port    //Store a value    $redis->set ("Say", "Hello World");    echo $redis->get ("say"); Should output Hello World    //Store multiple values    $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);    Var_dump ($redis->mget ($array _get));? >

  

Save, run. If you see, congratulations, start enjoying your redis!

Turn from by week, magical, original address: http://blog.sky31.com/archives/117

WINDOWS32-bit installation redis+ connection PHP

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.