How to install Memcache under Windows
Memcache installation under Windows:
1. Download the Windows stable version of memcache, unzip it and put it in a certain disk, such as c: memcached
2. Enter ‘c:memcachedmemcached.exe -d install’ in the terminal (i.e. cmd command interface) to install
3. Then enter: ‘c:memcachedmemcached.exe -d start’ to start. NOTE: In the future, memcached will be automatically started as a service of Windows every time you boot up. The server side has now been installed.
4. Download php tutorial_memcache.dll, please find the corresponding php version file yourself
5. Add a line ‘extension=php_memcache.dll’
to C:winntphp.ini
6. Restart Apache, and then check phpinfo. If there is memcache, it means the installation is successful!
Basic settings of memcached:
-p listening port
-l The IP address of the connection, the default is the local computer
-d start starts memcached service
-d restart restart memcached service
-d stop|shutdown shut down the running memcached service
-d install install memcached service
-d uninstall uninstall memcached service
-u Run as (only valid when running as root)
-m Maximum memory usage, in MB. Default 64MB
-M Return an error when memory is exhausted instead of deleting items
-c Maximum number of simultaneous connections, default is 1024
-f block size growth factor, default is 1.25
-n minimum allocated space, key+value+flags default is 48
-h show help
Memcache environment test:
Run the following php file. If This is a test! is output, it means the environment is set up successfully. Start to appreciate the charm of Memcache!
< ?php
$mem = new Memcache;
$mem->connect(”127.0.0.1″, 11211);
$mem->set('key', 'This is a test!', 0, 60);
$val = $mem->get('key');
echo $val;
?>