Memcache installation under Windows:
1. Download the memcache Windows stable version, extract and put under a certain disk, such as in c:memcached
2. Enter ' c:memcachedmemcached.exe-d install ' installation at terminal (also known as cmd Command interface)
3. Re-enter: ' c:memcachedmemcached.exe-d start ' start. Note: Later memcached will start automatically every time a service is powered on as windows. This way the server side is already installed.
4. Download the PHP tutorial _memcache.dll, please find the corresponding PHP version of the file
5. Join a line of ' Extension=php_memcache.dll ' in C:winntphp.ini
6. Restart Apache, then check phpinfo, if there is memcache, then the installation is successful!
Basic Settings for memcached:
-P Listening Port
The IP address of the-l connection, the default is native
-D Start memcached service
-D Restart Restart memcached service
-D Stop|shutdown shut down the running memcached service
-D Install installation memcached service
-d Uninstall Uninstall memcached service
-U Run as (only valid when run as root)
-m maximum memory usage, in MB. Default 64MB
-Returns an error when M memory is exhausted instead of deleting the item
-C Maximum Simultaneous connection number, default is 1024
-F Block size growth factor, default is 1.25
-N Minimum allocation space, key+value+flags default is 48
-H Display Help
Memcache Environment test:
Run the following PHP file, if the output is a test!, it means that the environment has been built successfully. Start to appreciate the charm of memcache!
< PHP
The code is as follows |
Copy Code |
$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; |
?>