Install Memcache in Windows XP
by Rekha[ Edit ] 2010-04-23 12:19:26
Install Memcache in Windows XP
The win32 version of memcached can be run both as a NT Service or from the command line. To install memcached as a service, follow the next steps:
1. Unzip the binaries in your desired directory (eg. c:\memcached)
2. Install the service using the command: 'c:\memcached\memcached.exe -d install' from the command line
3. Start the server from the Microsoft Management Console or by running the following command: 'c:\memcached\memcached.exe -d start'
4. Use the server, by default listening to port 11211
After memcache is installed,you’ll have to tie it in with PHP in order to use it.
1.Check your php extensions directory [should be something like: C:\php\ext] for php_memcache.dll
2.Now find your php.ini file and add this line to the extensions list.
extension=php_memcache.dll
3.Restart apache
4.Run this code to test the installation:
$memcache = new Memcache;
$memcache->connect("localhost",11211); # You might need to set "localhost" to "127.0.0.1"
echo "Server's version: " . $memcache->getVersion() . "
\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = "test";
$tmp_object->int_attr = 123;
$memcache->set("key",$tmp_object,false,10);
echo "Store data in the cache (data will expire in 10 seconds)
\n";
echo "Data from the cache:
\n";
var_dump($memcache->get("key"));
?>