Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable memcache in WAMP

Tags:

php

wamp

How to install memcache in WAMP?

I don't find any php_memche in php.ini.

What do I do now?

@Ryan

thanks for your step, now memcache enabled in WAMP, i have cross checked in the PHPINFO as well. memcache is displaying.

i have tried below example memcache sample. but throwing error.

<?php  $memcache = new Memcache; $memcache->connect('localhost:8085', 11211) or die ("Could not connect");  $version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\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)<br/>\n";  $get_result = $memcache->get('key'); echo "Data from the cache:<br/>\n";  var_dump($get_result);  ?> 

Getting below notice error.

( ! ) Notice: Memcache::getversion() [memcache.getversion]: Server localhost:8085 (tcp 11211) failed with: Malformed version string (0) in C:\wamp\www\memcache\sample.php on line 7 

What i missed...

like image 531
Bharanikumar Avatar asked Jun 10 '10 17:06

Bharanikumar


People also ask

How do I know if memcache is installed?

You can look at phpinfo() or check if any of the functions of memcache is available. Ultimately, check whether the Memcache class exists or not. e.g. if(class_exists('Memcache')){ // Memcache is enabled. }

Where is memcache config?

The default configuration file for Memcached is /etc/memcached. conf. It's also important to mention that by default, Memcached listens on port 11211 and is configured to listen on the localhost system. You can confirm this by checking the configuration file on line 35 as shown.


1 Answers

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
like image 86
Ryan Charmley Avatar answered Oct 03 '22 18:10

Ryan Charmley