Installing Redis under Window

Source: Internet
Author: User
Tags pconnect

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

Redis supports 32bit and 64bitto 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 (); Instantiating Redis

$redis->pconnect (' 127.0.0.1 ', ' 6379 '); Establishing a Redis service connection

$redis->set ($key, $value); Setting variables and variable values

$redis->get ($key); Get variable Value

$redis->close (); Turn off Redis connections

?>

This time you may not enter anything, this is because you have not installed the phpredis extension;

Redisis an open source useANSI Clanguage Writing, support network, memory-based and persistent journaling,Key-valuedatabase, and provides multiple languages forAPI. It can supportJava,C + +,C #,PHP,JavaScript,Perl,object-c,Python,Ruby,Erlangand many other languages developed. I wasWindowsunder the installation of a bitRedisservice. Use is good, installation of the time encountered some problems. Now share the operation I have installed to everyone. WithPHPoperation of 

First, you must download the Redis service package first. http://redis.io/download/download it and install it to the appropriate directory.

Then it's time to configure the PHP environment.

Download a php_redis.dll extension file First,Php_redis.dll:http://windows.php.net/downloads/pecl/snaps/redis/ 2.2.5/( php version, otherwise it may not be good). Put it in the php Extension Directory ext, and then add it in the php.ini

Extension=php_igbinary.dll

Extension=php_redis.dll

(Do not switch in order). Then restart the server. Access Phpinfo () in PHP file

If it can appear


Having this module proves that you have successfully installed it.

Then start the Redis service

When this starts, it proves that you can use the program to access it.

$redis = new Redis (); Instantiating Redis

$redis->pconnect (' 127.0.0.1 ', ' 6379 '); Establishing a Redis service connection

$redis->set ($key, $value); Setting variables and variable values

$redis->get ($key); Get variable Value

$redis->close (); Turn off Redis connections

Basically, you can use Redis to do something.

It's just a summary of my own when I look at Redis, and if anything is wrong, please correct me.

Installing Redis under Window

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.