Install Memcache Php Windows

Tutorial: Installing Memcache on Windows

There are plenty of guides on this, but I couldn’t find any that explained the actual importance and difference in PHP and Apache versions and bit versions – and thus which file to download and use. Based on the guides out there and my experience (many, many frustrating hours) on installing Memcache for localhost on two different Windows localhost setups, I created a guide on how you can install Memcache on Windows 7 – taking your installed software versions into account.

I use WampServer as my local webserver, but this guide should work on any webserver install, such as XAMPP.

As opposed to the quick and easy install-and-use on Linux, Memcache needs to be installed and started as separate process in Windows. And as far as I know, Memcache on Windows works only as Memcache, not Memcached with a ‘d’. Even though the install and process file is named Memcached, you still use Memcache (no ‘d’) when using it.

Install the service using the command: c:memcachedmemcached.exe -d install from the command line; Start the server from the Microsoft. Install Memcache to speed up PHP on IIS Posted on Thursday, December 5, 2013 7:33 pm by TCAT Shelbyville IT Department Another way to speed up PHP on Microsoft Windows IIS is by using memcache.

Before Searching for Files, Find Your Versions

Your PHP version, Apache version and webserver software’s bit version matters for getting Memcache to work. With WampServer you can open up localhost/ in a browser, and the PHP and Apache version should be listed in the info. I run Apache 2.2.21 and PHP 5.3.10 both at work and my stationary computer at home.

Then you need to find out if your webserver is 32 bit or 64 bit. Not Windows – but the webserver software, in my case WampServer (which can be installed both as 32 bit or 64 bit). If you still have the original install file it could give you a clue (with WampServer the install file ends with -x32 for 32 bit or -x64 for 64 bit. If you don’t have the original install file, open up Windows Task Manager and find httpd in Processes (assuming your webserver’s running). Running Windows 7 64 bit, the process name would be httpd *32 for 32 bit, or 64 bit if there are no asterisk and numbers after httpd. I run Windows 7 64 bit at both work and home, but at home I’ve installed 32 bit and at work I have 64 bit WampServer.

Written down your PHP version, Apache version and webserver’s bit version? Great, now you have all necessary info for finding and downloading the files.

What You Need to Find and Download

You need two things: a memcached.exe file which you use to install and start the Memcache process in Windows. The other is a php_memcache.dll file which you’ll add to your webserver so it recognizes Memcache as an extension. Both files need to match your webserver’s bit version. Let’s begin with the first one, the install file.

Either Google “memcached.exe windows 32 bit” (or 64 bit if you have that) or download the 32 bit file here.

Installing and Starting Memcache

Unzip the file into a separate folder, such as C:memcache.

Open up cmd.exe in Administrator mode. (That means right clicking on cmd.exe and choose “Run as administrator”). Navigate to the C:memcache folder.

First we install Memcache by typing

When it’s completed, we start Memcache by typing

If you open up Windows Task Manager, you should find memcached.exe *32 (or without the *32) in Processes. That was it! Memcache is now listening to the default port 11211.

Increasing Memcache’s Memory Limit

Just one more thing. By default, Memcache is set to a 64Mb memory limit, which is generally too small. To correct this, open up Registry Editor (regedit.exe). Navigate to:

In this folder, doubleclick on the ImagePath key, and add ” -m 512″ after its value data, so its full value becomes:

Now we’ve expanded Memcache’s memory limit to 512Mb. Close the Registry Editor. Let’s move on to the extension file.

Installing the Memcache PHP Extension

The webserver won’t know how to refer to Memcache until we install it as a PHP extension. So now we need to find a php_memcache.dll file that matches the Apache and PHP version and webserver bit version. The important thing is that you can’t use a file targeted at a higher PHP or Apache version than you have (lower works just fine), and it must match the bit version. Google “php_memcache.dll” with your PHP version and bit version and you should find a matching file quite easily. If you are lazy and have the same versions as I do, you can download copies of my 32 bit for PHP 5.3 and Apache 2.2.6 or 64 bit for PHP 5.3 and Apache 2.2.6.

Unzip and move the php_memcache.dll file into your webserver’s PHP extension folder. For WampServer the folder is located at:

Now we need to edit the webserver’s php.ini so we can tell it to load the Memcache library. With WampServer click the tray icon, hover over PHP and click php.ini to open it up in an editor.

Search for “extension=” and scroll down until you find several lines with “extension=php_….dll”. If the line has a preceding “;” it’s commented out and not active. At the end of the list of extensions, add a new line with:

Save, close php.ini and restart your webserver services.

If all went well and you used the right files, Memcache should be installed and ready to use! Write a simple Memcache test in PHP, see that it works and pop a beer. Cheers!

It’s Not Working!

Php

Click the WampServer tray icon, navigate to PHP and then PHP extensions, and see that “php_memcache” is in the list and is checked. Also double check that “memcache” is in the list of extensions on localhost/. If it’s not there, your webserver couldn’t load the memcache extension.

The most likely problem is that the php_memcache.dll file did not match. Check the Apache error log. If it spits out something containing 32 or 64 bit, the bit version is wrong. Otherwise it could be a mismatch to the Apache and/or PHP version. Remember to restart Apache every time you edit php.ini or tries a new extension file.

If all else fails, Google is your friend.

Installing Memcache PHP Extension

Ringtone cutter software for windows 7. Installing Memcache PHP extension article will explain how to install Memcache dll file both in Xampp and Wamp servers.

Follow the below steps for Installing Memcache PHP Extension in Wamp or Xampp

1) Download the memcache php extension zip file form this link

2) Unzip and find the php_memcache.dll file.

3) For Xampp server place the dll file in D:xamppphpext folder. Here considering that Xampp is installed in D Drive.

4) For Wamp server place the dll file in D:wampbinphpphp5.2.9-1ext folder. Here considering that Wamp is installed in D Drive.

5) Open the php.ini file which is located at D:xamppphp orD:wampbinphpphp5.2.9-1 for Xampp or Wamp servers respectively

6) Find and replace

with

7) If you cannot find this line simply add the following to the extensions list

8) Restart the server ( Wamp/Xampp)

To check the Installation is success or not

  • Please create a php file (phpinfo.php) some where in the wamp/xampp.
  • Run that file through browser.
  • Search for Memcache in the page .
  • If you can see it, means the installation is success and is working fine.

Note : 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.

Read Installation of Memcached service on Windows here

Read Installation of Memcached service on Ubuntu here