JAFFAR

Blog

Enable PHP memcache in windows

Posted by jaffar on September 11, 2013 at 9:40 AM

Steps to enable PHP memcache in Windows

  1. Download files http://downloads.php.net/pierre/php_memcache-2.2.6-5.3-vc9-x86.zip
  2. Extract and place in D:\wamp\bin\php\php5.3.10\ext\php_memcache.dll
  3. add the code "extension=php_memcache.dll " in php.ini file
  4. Download memcache.exe in http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip
  5. extract and place in D:\wamp\bin\php\memcache.exe
  6. Open command prompt
  7. type "cd d:\wamp\bin\php"
  8. type "D:\wamp\bin\php\memcached.exe -d install"
  9. type "D:\wamp\bin\php\memcached.exe -d start"
  10. Restart apache
  11. Test your memcache working execute the below code

   <?php
$memcache = new Memcache;
$memcache->connect('localhost', 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);
?>



   Refer: http://www.leonardaustin.com/technical/how-to-install-memcached-on-xampp-on-windows-7


Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

Already a member? Sign In

0 Comments