How to configure Memcache under Windows 7/8 System

Source: Internet
Author: User
Tags memcached vc9 zip

Today modified a long time ago a program, found that the new concept of data operation is far more complex than before, the original caching mechanism is not good, and do not cache the frequent reading of the data is too scary, so began to consider using memcache for caching.

Because need to test in this machine, so need to install memcache in My computer, but on the official website of Memcache, but can't find the download of the Windows version, check the data for a long time, Just know that there is a memcache called Windows stable version of the thing (many articles on the internet are wantonly reproduced, only to say download Windows stable version, and did not provide download address, Pit dad),

Download Address:
http://download.csdn.net/download/fengjunkuan2006/4801674

It seems not official, but running on Windows is not a problem, it is downloaded, stored in any directory, preferably pure English, such as I put in d:memcached, then start the command-line tool, Win7 or WIN8 user attention, the following operations require administrator rights, so directly in the "Run" Input "cmd" is not successful, you need to be found in the "Start Menu"-> "" Command prompt, right-click-> to run as administrator, or find Cmd.exe in C:windowssystem32, right-click-> Run as Administrator.
Use the CD command to locate Memcache.exe's storage directory, such as CD d:memcached. CMD program is located in the default C disk, running the above line command is not directly to switch, but also to enter "D:" Switch to D disk (seemingly so simple things do not need??) Aluminum tax larr;_←). Then enter the following command to install:

memcached.exe-d Install

Of course, you can also directly enter the full path, so you do not need to locate, such as: d:memcachedmemcached.exe-d Install (Good??? larr;_←). Start the service with the following command after installation:

memcached.exe-d start

Next download Php_memcache.dll, download the address:

Http://downloads.php.net/pierre/

Find Php_memcache, download it. This page provides two versions, seemingly all only support PHP5.3, use the other PHP version of children's shoes if not, try to look elsewhere. Here I downloaded the php_memcache-2.2.6-5.3-vc9-x86.zip, and the other php_memcache-2.2.6-5.3-nts-vc9-x86.zip didn't work with my PHP version.

Download the unpacked folder after extracting it in the PHP installation directory, then modify PHP.ini, add Extension=php_memcache.dll.

Restart Apache (or Balabala, such as IIS, Nginx), open view phpinfo (this I don't?? Aluminum larr;_←), if you can find memcache, that means the installation is successful, if not, check if your Php_memcache.dll version is right, to see if the Memcache installation is successful or the service is started and so on.

OK, now you can use Memcache in PHP if the output "This is a test!" Indicates that the configuration was successful.

  code is as follows copy code

<?php
$mem = new Memcache;
$mem->connect ("127.0.0.1", 11211);
$mem->set (' key ', ' This is a test! ', 0, 60);
$val = $mem->get (' key ');
Echo $val;
?

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.