Installing Memcache on Windows


Memcache is a caching system used to speed up web applications by holding small pieces of arbitrary data, it could be broadly compared to the $_SESSION variable in PHP, but memcache works across the whole application not just on a per user basis and has been successfully proven to make great gains in speed increases on web applications.

Memcache was designed with Linux in mind and not windows, so it has posed some installation issues because Windows users are not so familiar with having to compile code from source as memcache does not come with any installation software.


  • Download memcached. Use the win32 binary version.
  • Unzip and copy the binaries to your desired directory, eg. C:\memcached. There is usually only one exe file.
  • If you are using Vista
    • right click on memcached.exe
    • click Properties
    • click the Compatibility tab
    • Near the bottom you’ll see Privilege Level, check “Run this program as an administrator”.
    • Apply the changes
  • If you are using Windows 64bit then this dll file will work instead of the links mentioned above.
  • Make sure that in perInstance.php memcache server’s host has the correct value, that is either ’′ or ‘localhost’ or appropriate value as per your memcached server setup.
  • Install the service using the command:
    C:\memcached\memcached.exe -d install

    from the command line

  • Start the server from the Microsoft Management Console or by running one of the following commands:
    C:\memcached\memcached.exe -d start


    net start "memcached Server"


Installing PHP Extension

    • Check your php extensions directory for php_memcache.dll
    • If you don’t have it, Download and copy it to your php extension folder.
    • Edit your php.ini file and add following to the extensions list:
    • Restart webserver for the new php.ini to take effect.

Testing Memcache and PHP’s Extension

Here’s some sample code from


  $memcache = new Memcache;
  $memcache->connect("localhost",11211); # You might need to set "localhost" to ""
  echo "Server's version: " . $memcache->getVersion() . "<br />\n";
  $tmp_object = new stdClass;
  $tmp_object->str_attr = "test";
  $tmp_object->int_attr = 123;
  echo "Store data in the cache (data will expire in 10 seconds)<br />\n";
  echo "Data from the cache:<br />\n";


If you have any errors, it will most likely be because the php extension didn’t run Check the webserver error log to see if it had problems starting. The most common problem is the version of memcache.dll is not compatible with the version of php you are running.

Leave a Comment

  • Faizan

    Great (Y)!!!

  • Iss

    Make sure that in perInstance.php memcache server’s host has the correct value, that is either ’′ or ‘localhost’ or appropriate value as per your memcached server setup.
    Hi, not sure what this means?

  • Stafford McKay

    Can you join the Dev Session today so we can go over your issue? We have Developer Sessions every Tuesday at 10:00AM Chicago Time (

  • pan sengtat

    I downloaded the DLL file from the given link and after starting Apache/MySQL through XAMPP, I got this message:

    PHP Startup: memcache: Unable to initialize module
    Module compiled with module API=20090626
    PHP compiled with module API=20100525
    These options need to match.

    Looks like the memcache.dll file in the download link is for an older PHP version, a workaround can be used based on this link for newer PHP versions:

    • nucreativa

      try looking php_memcache.dll that build for your php version. . ex : if you using php 5.4 thread safe try use

      • august calendar 2018 printable

        C:memcachedmemcached.exe -d start

  • Pierre Joye

    A quick note:

    All pecl packages should be available here (snapshots or releases):

    including memcache releases.

  • steven lee

    Nice tutorial,I have did as it,and it works well.

  • Mahendra Varma

    well can you guide me how i installed memcached in local server wamp. i download from here .dll file for my php version 5.4.16 and put that wampbinphpphp5.4.16ext here and after that i restart my wamp but still in php.ini i can’t show php_memcached.dll . please any one give suggestion .

    • abc

      php_memcache.dll != php_memcached.dll – php_memcacehd.dll doesn’t exist :/
      the different situation is at UNIX :) exists and exists:)

  • mahesh

    I installed memcached by reading your article on Windows7 but unfortunately i keep getting error as follows:—
    Fatal error: Class ‘Memcache’ not found in D:xampphtdocstestmemcachetest.php on line 2

    Line 2: $memcache = new Memcache;

    • Asif Mansoor

      Did you check the php logs in xampp to see if it is able to load the memcache extension?

  • Asif Mansoor

    Nice article. Thanks for sharing..

  • William Tsuruta

    Hi thanks for so nice article.
    Well I need your help please because Ive installed and using the page to check I can receive the version f server but nothing about the data on cache.
    This is a portion of my info.php and as I think that the memcahed was loaded in php but why I dont have nothing as the cache result in the page test?
    My php version is 5.3.26 threadsafe vc9 in a win2K3 standard edition
    the version of the memcached is the php_memcache-3.0.8-5.3-ts-vc9-x86
    Also please in this version we have the file php_memcache.pdb that like to be the database of the memcached but where it must be placed?


    memcache supportenabled
    Version 3.0.8
    Revision $Revision: 329835 $

    DirectiveLocal ValueMaster Value

    Thanks for any help.

  • Michael

    Thank you for that piece.
    Could windows users still possibly get a
    recent php dll extension for the memcached package (as opposed to
    memcache)? My current use case requires the memcached extension, and
    pecl has no dll’s for that.

  • Albert H

    I downloaded the 64bits version and the cmd keep waiting in black screen, i can’t write in the console any idea?

  • Anil Sahu

    i follow your steps but having error Fatal error: Class ‘Memcache’ not found in C:xampphtdocslaravel_prsmetest.php on line 3

  • Sudhir Gupta

    above step is not working. after installing the same i am getting following error.

    Fatal error: Uncaught Error: Class 'Memcache' not found in C:xampphtdocsmemTestindex.php:3 Stack trace: #0 {main} thrown in C:xampphtdocsmemTestindex.php on line 3