Tags

  1. Download the correct build here.
  2. The archive should contain php_memcache.dll. Extract the archive to your php extensions directory. On my system (i use XAMPP), this was C:xampp\php\ext
  3. Edit php.ini, add this line to enable the extension:
    extension=php_memcache.dll
    
  4. Finally restart your server.

    To test your memcache installation run this piece of code in your machine:

$memcache = new Memcache;
$memcache->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 = 'hello';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 2) or die ('Failed to save data at the server');
echo 'Store data in the cache (data will expire in 2 seconds)';
$get_result = $memcache->get('key');
echo 'Data from the cache:';

var_dump($get_result);
print_r($get_result);
Advertisements