Installation configuration method for Windows under memcached
1, unpack the first package under a disk, for example, in c:\memcached.
2. Enter the ' c:\memcached\memcached.exe-d install ' installation in the terminal (also known as CMD Command interface).
3, re-enter: ' c:\memcached\memcached.exe-d start ' start. (Note: memcached will start automatically every time a service is turned on for Windows.) This way the server side is already installed).
4. Download the Php_memcache.dll file and put it in the ext directory of the PHP folder.
5. Add a one-line reference extension to the php.ini code as follows:
Extension=php_memcache.dll
6. Then add the following in the php.ini file:
It's best to put it under the "Extension=php_memcache.dll" just now. (This is some of the default configurations)
7, restart Apache, and then check the phpinfo, if there are memcache instructions, then the installation is successful!
Write a example.php file (more ways to use the Memcache Functions instructions in the PHP manual) and test the code as follows:
<?php$memcache=New Memcache;$memcache-Connect(' localhost ',11211)OrDie("Could Not Connect");$version=$memcache-GetVersion();Echo"Server S version:".$version."<br/>\n";$tmp _object=New StdClass;$tmp _object->str_attr=' Test ';$tmp _object->int_attr=123;$memcache-Set(' Key ',$tmp _object, False,10)or die (); echo "Store data in the" cache (data would expire in seconds) <br/> ; \ n " $get _result = $memcache ->get ( ' key ' echo "Data from the cache:<br/>\n" var_dump ( $get _result ?>
If the output is as follows, the test succeeds:
Basic parameter settings for memcached:
- -P Listening Port
- -L connected IP address, default is native
- -D Start memcached service
- -D Restart Restart memcached service
- -D Stop|shutdown Close the running memcached service
- -D Install memcached service
- -d Uninstall Uninstall memcached service
- -U Run as (only valid when running as root)
- -m maximum memory usage, in megabytes. Default 64MB
- -M running out of memory and returning an error instead of deleting an item
- -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 Display Help <-->
How to configure php+memcached for Windows installation