How to Enable Memcache in Wamp

How to enable memcache in WAMP

Here are the steps that worked for me:

Needed Files

  • memcached.exe Direct Link
  • MSVCP71.DLL Windows DLL Files
  • msvcr71.dll
  • php_memcache.dll Working memcache for PHP 5.3.4 OR REF

Steps

  1. Copy MSVCP71.DLL, msvcr71.dll to C:\windows\sysWOW64
  2. Copy memcached.exe into C:\memcached
  3. Click Windows-Key
  4. Type: CMD
  5. press: Ctrl-Shift-Enter
  6. Choose yes
  7. type: C:\memcached\memcached.exe -d install
  8. type: C:\memcached\memcached.exe -d start
  9. Copy php_memcache.dll to C:\wamp\bin\php\php5.3.4\ext
  10. Restart Apache using Wamp controls
  11. Enable WAMP -> PHP -> PHP Extensions -> php_memcache

how to enable memcached in wamp in windows?

It looks like you are trying to connect MySql server without installing it. First you have to install a memcached server. You can use couchbase server with memcache bucket on Windows. IMHO it's the best port for Windows OS.

php_memcache.dll for WAMP 2.5 - PHP : 5.5.12 - Window8:64 Bit - VC11

The warning icon means one of 2 things when seen on the extension menu.

  1. There is a dll in the ext folder but there is no matching extension=php_memcache.dll entry in the PHP.INI file.
  2. There is a extension=xxx.dll in the PHP.INI file but no matching dll in the ext folder.

So if you copied the dll into \wamp\bin\php\phpx.y.z\ext folder then you need to add the extension=php_memcache.dll to the PHP.INI file. Remember this is not a default extension as you needed to download it yourself, so there will be no entry in the php.ini file for it either.

Also remember that you have to install MEMCACHED as the extension on its own is just an interface to the MEMCACHE service.

Also you will need the Thread Safe version of the memcache.dll to run with WampServers configuration of Apache and PHP.

Also make sure you have the right 32/64bit version of memcache.dll to match the version of WAMPServer you installed.

Also remember there are 2 php.ini files, to edit the one used by Apache, use the wampmanager menus like so :-

wampmanager -> PHP -> php.ini

That will launch your editor on \wamp\bin\php\php{version}\phpForApache.ini

The other one \wamp\bin\php\php.ini is only used by the PHP CLI (Command Line Interface) and will have no effect on what is loaded to an Apache instance.

WAMPSERVER php_memcache extension

Your extension probably not fit the compilation mode of wampserver.
Is it compiled with vc9 (visual 2008) and a non threads safe support ?

My wampserver (latest available) is compiled in VC6 TS.
To know this info check phpinfo() on line :

  • Compiler
  • Thread safety

php_memcache extension in wamp

There are two memcache extensions memcache and memcached.

It looks like you have installed memcached but you need memcache (i.e. php_memcache.dll)

Download Link: https://pecl.php.net/package/memcache/3.0.8/windows

Edit: Sorry I misread your post above and read that you had installed php_memcached.dll however you do actually say you've installed what I've suggested, are you sure the correct DLL has been added?

codeigniter2 deploy on windows 10 with wamp server, memcached error fix

I solved my problem:

Step 1 (enable Memcache in WAMPserver):

  • download the Memcache package that compatible with your PHP version
    and Wamp version (32 or 64 bits). I download the Thread Safe one.
  • extract the downloaded package then copy the php_memcache.dll into
    your extensions folder of your PHP such as
    C:\wamp64\bin\php\php5.6.40\ext. The php5.6.40 is your PHP folder.
  • open the php.ini file and search for extension=php_bz2.dll which
    should be the first extension on the extensions list then copy
    extension=php_memcache.dll and paste at the end of the extensions
    list.
  • restart Wamp server
  • now you should see the Memcache loaded when you visit
    http://localhost

If the steps above don’t work, you just open the error log file at the logs folder at the root directory and check the error there.

Step 2 (Changes in /system/libraries/Cache/drivers/Cache_memcached.php):

Using this github link, i made changes in Cache_memcached.php:

Replace this:

$this->_memcached = new Memcached();

With this:

if (class_exists('Memcached')) {
$this->_memcached = new Memcached();
}
else if (class_exists('Memcache')) {
$this->_memcached = new Memcache();
}
else {
log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?');
return FALSE;
}

And replace this:

if ( ! extension_loaded('memcached'))

With this:

if ( ! extension_loaded('memcached') && ! extension_loaded('memcache'))

Then delete (if exists):

$this->_memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$this->_memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);

And this (if exists):

$this->_memcached->setOption(Memcached::OPT_PREFIX_KEY, $prefix);

Step 3 (Refresh Database):

  • Delete and create new database
  • import data (if big data you can import it via wamp server mysql
    console "use dbname; source c:/wamp64/www/dataname.sql")
  • restart wamp server


Related Topics



Leave a reply



Submit