Install PHP Memcache extension
- Download the correct build here.
- The archive should contain
php_memcache.dll. Extract the archive to your php extensions directory. On my system (i use XAMPP), this wasC:\xampp\php\ext\ -
Edit
php.ini, add this line to enable the extension:extension=php_memcache.dll
-
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)
\n';
$get_result = $memcache->get('key');
echo 'Data from the cache:
\n';
echo '';
var_dump($get_result);
print_r($get_result);
blog comments powered by Disqus
-
nerdycat posted this