Redis installation and extended installation under Windows

Source: Internet
Author: User
Tags pconnect phpinfo

:https://github.com/dmajkic/redis/downloads.

Redis supports 32bit and 64bit to download. Depending on your actual situation, select the 64bit content CP to the custom drive letter installation directory named Redis. such as C:\reids

Open a CMD window using the CD command to switch directories to C:\redis run redis-server.exe redis.conf .

If you want to be convenient, you can add the path of Redis to the environment variables of the system, so as to save the path again, the latter redis.conf can be omitted, if omitted, the default is enabled. After entering, the following interface is displayed:

At this time another cmd window, the original do not close, otherwise you will not be able to access the server.

Switch to the Redis directory to run the redis-cli.exe-h 127.0.0.1-p 6379 .

Set the key-value pair set MyKey ABC

Remove key value pair get MyKey

This time the command line has been tested successfully, next Test Redis in PHP code

<?php

$redis = new Redis (); Instantiation of Redis$redis->pconnect (' 127.0.0.1 ', ' 6379 '); To establish a Redis service connection this pconnect should be a long connection that can be used with Connect$redis->set ($key, $value); Set variable and variable values echo $redis->get ($key); Gets the variable value $redis->close (); Turn off Redis connections

?>

Run the code and you will find an error, and the number of lines of error is in set, because your PHP has not yet installed the Redis extension, so you cannot set the value.

Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. It can support multi-language development such as Java,c/c++,c#,php,javascript,perl,object-c,python,ruby,erlang. I installed the Redis service under Windows.

Next we start installing the PHP extension

1. Use the Phpinfo () function to view PHP version information, which will determine the extension file version

Next, according to your proposed version to the following two URLs to download files

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

2, HTTP://WINDOWS.PHP.NET/DOWNLOADS/PECL/RELEASES/IGBINARY/1.2.1/

After decompression, copy the Php_redis.dll and php_redis.pdb to the PHP ext directory

Then start configuring PHP.ini

Add these two lines of code:

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

Reboot your Web server and if the reboot succeeds, look for the redis extension in Phpinfo:

This means that your Redis extension is also installed successfully!!!

Run the code you just started and you'll find it!

Note that the above mentioned two black windows in any case, can not be turned off, because you are the Windows as a server use!!!

Linux reference:

Http://www.cnblogs.com/jshen/archive/2013/07/05/3173729.html

Http://www.cnblogs.com/yangxia-test/p/4195198.html

Redis installation and extended installation 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.