Installing Memcached for PHP 5.3 on Windows 7


First off, all credits go to this guy. I’m just listing the steps on how I did it in Windows 7 with PHP 5.3. Also, I tested this using WampServer but I believe it should work on any PHP install.

Install memcached

  1. Download the Memcached Win32 library here: Just get the Win32 binary (direct link). Extract the downloaded archive file in a directory (e.g. c:\memcached). There should be a memcached.exe in there.
  2. Run a command prompt as an administrator. Some info on how to do that here.
  3. Install memcached as a service. Go to the memcached directory, type and run:

    memcached -d install

    If you get an error saying “MSVCP71.dll is missing”, see this page for a solution.

  4. Start the memcached service by running:

    memcached -d start
  5. You can verify if memcached is running by executing this in the command line:

    wmic process get description, executablepath | findstr memcached.exe

    You should see a result list showing memcached.exe and its full path.

Install PHP Memcache extension (php_memcache.dll)

  1. Chances are you don’t have php_memcache.dll in your PHP extensions yet. You can download a build of it here. Basu has noted in the comments that VC6 builds are no longer available from that link. You can download the correct build here.
  2. The archive should contain php_memcache.dll. Extract the archive to your php extensions directory. On my system (WampServer), this was C:\wamp\bin\php\php5.3.0\ext.
  3. Edit php.ini, add this line to enable the extension:


    Or if you’re using WampServer, restart it and enable the extension through the WampServer system tray menu.


Test the installation using the sample PHP code here:

  • http://- orlando

    this is sucks, the php client library is not memcacheD its just ‘memcache’ (without D), if any of you find this fucking D please let me know.

  • Shiki

    @orlando Thanks for pointing that out. Sorry I always get confused by that D.

  • paul

    Tnx man, you saved my life :D

  • Dominic Watson

    how are we supposed to let you know? you didn’t provide contact details ^^

    Thanks for this article

  • Ronen

    Great helpful work Shiki! worked great for me. Thanks.

  • Onore

    Hiya! in new version memcached without param .. Thanx for this post

  • Angelin

    The link to the dll is broken…

  • Shiki

    @Angelin, try the other files here: . Search for “php_memcache”.

  • basu

    VC9 versions are there but not VC6 which you need for Apache.

  • basu
  • Shiki

    Thanks Basu, I updated the post.

  • Daok

    The link require a password?

  • Hussam

    Hi there, Also after providing my password, it says I don’t have permission to access the file :(

  • Shiki

    @Daok and @Hussam thanks for the info! You can download it here:

  • Shehi

    @orlando: That fracking D is Linux-only extension since it utilizes “libmemcached” component which is a Linux-specific thingie… So, no luck there.

  • Shihab

    Thanks for the post. I have installed the memcache and php extension. But when I tried the example like getVersion it returnes nothing. $memcache = new Memcache; // instantiating memcache extension class $memcache->connect("",11211) or die ("Could not connect"); // try instead of localhost // if it is not working

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

    This gives me the following result. Can you help me?

    Memcache Object ( [connection] => Resource id #3 ) Server version:

    That is memcache is installed. But the getVersion is not working?

  • Shiki

    @Shihab hmmm.. sorry I’m not exactly sure what’s wrong. Everything’s working fine on my end. But are the $memcache->set() and $memcache->get() methods working though?

  • viktor

    Guys, your article gives a solution to this problem, article is best!

  • Shihab

    I tried $memcache->set() and $memcache->get() also. But not working.. return nothing…

  • Shihab

    When I tried by enabling the error logging with error_reporting(-1); ini_set('display_errors', true);

    I got the error Notice: Memcache::getversion() [memcache.getversion]: Server (tcp 11211) failed with: Failed reading line from stream (0) in …

  • Shiki

    I suppose the problem is in memcached.exe then. Can you confirm that memcached is running? You can test it by executing this on the console:

    wmic process get description, executablepath | findstr memcached.exe

  • Shihab

    Yes.. It is running… I got the following result for your command

    memcached.exe D:\memcached\memcached.exe

  • Shiki

    That’s weird. Sorry I have no other ideas right now. Checking if tcp 11211 is blocked or used might be worth a shot. It looks like this is also a common problem.

  • Nate

    I’ve got the php extension finally working on wamp server 2.1, the secret was here:

    the thread safe dll!

  • Zeke

    Thanks for the excellent post and for providing a link to the mysterious file!

  • pompo500

    For people curious to try memcached/memcachedb without installing an extension to PHP, try this pure-PHP library:

  • sem

    Thanks a lot. Really appreciate this page.

  • Pingback: php的数据对象、结构的存储 | Wang Jun's Blog()

  • DC Vaishnav

    I really like this site bcoz it help me to start memcached in my localhost . u must see it is great

  • chandru

    Where can i find the installed memcache server and what is remaining storage area? Simply i want to know benchmark.

  • Thom

    Thanks for this – works perfectly. I can confirm this works for XAMPP as well.

  • Pingback: Instalasi Memcache untuk PHP 5.3 Win 7 « Catatan Kuliahku di TI UIN Jakarta()

  • Jussuf

    Thanks for that entry, it helped me getting through the installation process the short way, with XP and VC6 builds however, so especially thanks for that vc6-download link.

  • Melner

    Thank you! Worked fine for me.

  • pogo

    Thanks for providing the VC6 compiled memcache dll !

  • Rod_T

    Thank you! This is exactly what I needed to get memcached going.

    Does anyone know how to SET the amount of memory that memcached will use? On my Linux server, I can start it with the “-m 256″ option to give it 256 Mb. How can I do the same on a Windows 7 box where the o/s starts the service automatically. I have not yet found where I have access to change the startup command it uses.


  • Mubashar Ahmad

    Unable to run the example every other thing seems fine but when I try to run it says, Class Memcache not found. seems like extension is not enabled but have checked php.ini and ext folder as well, may be wrong extension was downloaded can some one let me know which extension file i need,

    php 5.x, windows 7(64 bit), apache, (no xamp, no wamp), downloaded binaries of memcached server. please help

  • Shiki

    Hi Mubashar, it’s probably because you’re on 64 bit Windows. I’m not sure if this will work on that.

  • Madhu

    Thank you very much for the info.

    First when I tried it was giving a error ‘Fatal error: Class ‘Memcache’ not found’.

    Following this post, I realized I have used the wrong dll file. i was using vc9. Now I am using vc6 and no errors. :-)

  • Pingback: XAMPP, Memcached, Windows (installation) kurulumu | CEA Blog()

  • kevin

    Yeah,thanks for the link to that file!

  • wern

    Thank you! I really appreciate your effort in making this post. I’m stuck at making this memcached work on windows, and then I found your awesome blog at stackoverflow.

  • Pingback: How to use memcache « Data Integrated Entity()

  • Avinash

    I have placed the php_memcache.dll in extension directory and placed the relevant code in PHP.ini

    But After this my apache is not starting. Any thing I am missing?

  • Shiki

    @Avinash I currently don’t have an idea what could be missing. But I would check Apache’s error log. There might be some clues in there.

  • friv games

    php code to test:

    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";


  • Nehaa

    I am using WAMP on windows7 .My php code connect(“localhost”,11211)or die (“Could not connect”); // try instead of localhost $testArray = array(‘horse’, ‘cow’, ‘pig’); $tmp = serialize($testArray); $memcache->add(“key”, $tmp, 30); echo “Data from the cache:\n”; print_r(unserialize($memcache->get(“key”))); ?> is working absolutely fine but instead of memcache class i want to use memcached class i.e. $memcache = new Memcached; it is giving me class Memcached not found.Please help me what other changes i have to make? Thanks Nehaa

  • Shiki

    Sorry Nehaa, this is only for the “Memcache” extension.

  • Ezekiel Victor

    This is a brilliant post. Thanks.

  • Alireza

    thanks for sharing this. actually i need help. i installed memcached and it is started. but when i check my code it says “Class ‘Memcache’ not found” . please help me.

  • Shiki

    @Alireza can you check with phpinfo() if Memcache is properly installed?

  • sundar

    Im unable to install memcache in windows 7 , 64 bit could you please provide more information. when i check incompatibility, it shows up to windows xp.

    Thanks in advance.

  • sundar

    Sorry for the ast post

    Im unable to install memcache in windows 7(64 bit). Could you please provide more information. when i check compatibility, it shows up to windows xp.

    Thanks in advance.

  • sundar

    thanks for u r hep, it is a permission problem in windows 7, I copied file into windows\system32 folder and run from command prompt as Administrator

    Thank you! Worked fine for me. But, i need memcached, if yo have any idea, Could you please help me.

    Thanks In advance

  • Shiki

    @sundar Sorry I tried looking for a memcached dll before but could not find any. I’m not sure if it is even available on Windows.

  • Mark

    Hi – FYI for people here – I found a location for memcache on win 7 64 – follow this thread – I used the dll and have it working with WAMP php 5.3.9 — I’m happy now :)

  • Pingback: windows搭建memcached环境_三水清()

  • Pingback: PHP и Memcached | 9lessons: блог о программировании, jQuery, Ajax, PHP и MySQL()

  • Pingback: Installing Memcache Server for PHP on Windows |

  • Jimmy

    I tell you wot, this works awesome :D Keep up the good work

  • real estate

    thats terrific publish, i want the software.

  • Pingback: Memcached with PHP. | Indian Hot News()

  • Matthew Purdon

    Hey there,

    For windows 7, 64 bit right click on the exe and select properties. Under the compatibility tab check “Run this program as an administrator” and then follow the process from the start. You should get the pop-up warning that it’s going to make changes to the system to let you know that it’s going to work.



  • Pingback: PHP应用memcached的示例 | PHP爱好者()

  • Pingback: Memcache not working on PHP 5.3.10 | PHP Developer Resource()

  • Dave

    I had the “PHP Fatal error: Class ‘Memcache’ not found” error too which is a vc version mismatch between php distribution and module

    C:\Users>php-cgi.exe -b PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with build ID=API20090626,TS,VC6 PHP compiled with build ID=API20090626,TS,VC9 These options need to match in Unknown on line 0

    I solved it by downloading and installing the vc9 version from the old page:

    If you have nts php distribution then maybe you need:

    Shiki, thanks for this article!

  • ashutosh

    i got this error

    Fatal error: Class ‘Memcache’ not found in F:\wamp\www\testmem\one.php on line 3

    what is the problem?

  • Shiki

    @ashutosh, probably not installed properly. Or you could try restarting Apache.

  • Pingback: Cgi script installation service()

  • Kanan Langin-Hooper

    If you are running 64 bit WAMP:

    The common service and extensions will not work for you.

    Install the 64 bit memcached service:

    And one of these php extensions (to match your php version):

    Php 5.3:

    Php 5.4:

  • Sid

    Hi! Thanks for your post. Its helpful. But I am wondering is there a memcached.dll available? Or is it only for servers based on Linux? Thanks.

  • Shiki

    @Sid do you mean php_memcached.dll? There’s a link to a download in the article.

  • Sid

    @Shiki, the link downloads php_memcache.dll and not php_memcached.dll. The difference is in the ‘d’ :)

  • Shiki

    @Sid my bad. Sorry about that. I’m not sure if there is a php_memcached.dll.

  • Sid

    Okay I got the point. Memcache is for Windows and Memcached is for Linux. Do not get confused on it folks !!!

  • Pingback: 给PHP安装Memcache扩展 | JSCON-简时空()

  • Piyush

    Hi Friends,

    I have coded a Session Handler for my website but when i am working on it. The site is showing an error below: – SCREAM: Error suppression ignored for ( ! ) Fatal error: Interface ‘SessionHandlerInterface’ not found in C:\wamp\www\Anon\website_development\WWW\controller\session_handler.php on line 10

    I don’t know what is wrong, i have installed memcache also. then also its not working. Can anyone help me? I really need it.

  • Pingback: PHP应用memcached的示例 | 我这样爱你()

  • Mark

    Actually there is a php_memcache.dll and a php_memcached.dll, two different memcache libraries for PHP, php_memcache.dll is the older one more common used one, php_memcached.dll is newer with more features (

    The real question is where does one get Windows binaries of php_memcached.dll, which are not on

  • Tom

    I would agree with you Mark. There doesn’t seem to be a memcacheD option for PHP/Windows right now.

  • lin

    thx,it works well.

  • Pingback: MemCache Installation for window XP | My personal()

  • Scottmas

    I can confirm that this does indeed work on windows. I just accessed memcached with a php script running on my local machine. You need to make sure you have php 5.3.0 installed, since it’s the version which the link the author provided to php_memcache.dll is compatible with.

  • Marcus Fenix

    I update the post with new link for windows 8/8.1 and for php 5.2-5.5

  • adam smith

    Why on earth would you say installing Memcached while this article is about Memcache ? a lot of you people are doing this, memcached has no installation for local windows yet