Instructions for installing memcached under Windows

Source: Internet
Author: User

(In fact, installation under Windows is still relatively simple)

SOURCE Package Preparation:

1,memcached 1.2.1 for Win32 binaries

This is the WIN32 server-side memcached the latest version, directly download it;

2,php_memcache-5.2-win32-vc6-x86-20090408.zip

This is the PHP required PECL extension, that is, Php_memcache extension, (must be the same version of PHP, I use the 5.2.1)

With the source of the package, then start to eat it, follow the steps below

1. Unpack the first package under a disk, for example in c:\memcached
2. Enter the ' c:\memcached\memcached.exe-d install ' installation in the terminal (also known as the cmd Command interface)
3. Re-enter: ' c:\memcached\memcached.exe-d start ' starts. (Note: memcached will start automatically every time a service is turned on for Windows.) So the server side is already installed)
4. Unzip the second package, there will be only one php_memcache.dll file, put it into the usr/local/php5/ext/
5. Add a line of ' Extension=php_memcache.dll ' to C:\WINDOWS\php.ini (don't know why PHP has two configuration files, one in Usr/local/php5/php.ini, and the other in c:/ windows/, and only to change the previous configuration file does not work, so the WINDOWS php.ini also get rid of! )

6, then add the following in the php.ini file:

Copy CodeThe code is as follows:
[Memcache]
Memcache.allow_failover = 1
Memcache.max_failover_attempts=20
Memcache.chunk_size =8192
Memcache.default_port = 11211


It's best to put it under the "Extension=php_memcache.dll" just now. (This is some of the default configurations)
6. Restart Apache, then check the phpinfo, if you have memcache instructions, then the installation is successful!

Trial run:

Write a example.php file: (see the Memcache Functions instructions in the PHP manual for more information on how to use it)

Copy CodeThe code is as follows:

<?php

$memcache = new Memcache;
$memcache->connect (' localhost ', 11211) or Die ("Could not Connect");

$version = $memcache->getversion ();
echo "Server ' s version:". $version. " <br/>\n ";

$tmp _object = new StdClass;
$tmp _object->str_attr = ' Test ';
$tmp _object->int_attr = 123;

$memcache->set (' key ', $tmp _object, False, or Die ("Failed-to-save data at the server");
echo "Store data in the cache (data would expire in seconds) <br/>\n";

$get _result = $memcache->get (' key ');
echo "Data from the cache:<br/>\n";

Var_dump ($get _result);

?>


If there is output:

Copy CodeThe code is as follows:
Server ' s version:1.4.5
Store data in the cache (data would expire in seconds)
Data from the cache:
Object (StdClass) #3 (2) {["Str_attr"]=> string (4) "Test" ["Int_attr"]=> int (123)}


That means our Memcached is working! :~>

If the above address cannot be downloaded, you can download it to http://www.splinedancer.com/memcached-win32/

Instructions for installing memcached under Windows

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.