How to install Memcached on Win 7 + WAMP Server, the simplest way of all

How to install Memcached on Win 7 + WAMP Server, the simplest way of all

You can reach source code of memcached from its official web site. Since it is hard to compile memcached from its source code on Windows platforms, we will use a precompiled package (created for Win 7 + PHP 5.3). Download package from here and extract into C:\wamp\bin folder beside other services. Note that, memcached is a service just like MySQL and you have to connect memcached in order to use it.

- First of all, we have to install memcached as a service. So, open command prompt as administrator in folder C:\wamp\bin\memcached and run:

memcached -d install

- Start the memcached service by running:

memcached -d start

- You can verify if memcached is running by executing this command (You have to see full path of memcached.exe):

wmic process get description, executablepath | findstr memcached.exe

Install PHP Memcache extension (php_memcache.dll)

- If you don’t have php_memcache.dll in folder C:\wamp\bin\php\php5.x\ext, download it from here and extract into this directory.

- Open php configuration file php.ini from C:\wamp\bin\apache\Apache2.x\bin directory, and add the following line to the end of Dynamic Extensions block which lies between lines 920 and 990 roughly.


- Restart all services of Wamp Server through the system tray menu.

Testing Memcached with PHP

< ?php

$memcache = new Memcache;
$memcache->connect('localhost', 11211)
        or die
("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: " . $version . "\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10)
        or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)\n";
$get_result = $memcache->get('key');
echo "Data from the cache:\n";


added 10 years ago

- What is MRI Scan?
- The most interesting facts about lions
- MKV vs MP4 (M4v)
- Turn PC off every night or leave it on 24/7?
- What resolution does the human eye see in?
- What does chess ELO ratings mean?
- Search Engine optimization: Google's 200 Ranking Factors
- iPhone 4S vs iPhone 5 vs Samsung Galaxy S3 comparison results
- How to Install Oracle Java on Ubuntu Linux? Java Performance Problems
- What is CSS and why is it useful?
- How to Use a Router as a Repeater?
- How to install Memcached on Win 7 + WAMP Server, the simplest way of all
- How to restart page numbering for each chapter in Word 2007 – 2010