Home  >  Article  >  Backend Development  >  Detailed tutorial on Memcache installation under Windows

Detailed tutorial on Memcache installation under Windows

PHPz
PHPzOriginal
2017-03-12 09:33:561834browse

Many phpers don’t know how to set up the development and debugging environment of Memcache under Windows. Recently, I have also been studying Memcache and recorded the installation and construction process of Memcache under Windows. (Detailed steps for installing and starting memcache under Linux)

Actually, when I started studying Memcache, I didn’t know that there was actually memcached for Win32, which was harmful. It took me a day of hard work under CnetOS to get it done. Today I suddenly discovered that Memcache under Windows has no problem at all in development and debugging, so I wrote a Memcache document to share with everyone.

Memcache installation under Windows:

1. Download the windows stable version of memcache, unzip it and put it under a certain disk, such as c:\memcached

2. In the terminal (i.e. cmd command interface), enter 'c:\memcached\memcached.exe -d install' to install

3. Then enter: 'c:\memcached\memcached.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_memcache.dll, please find the corresponding php version file yourself

5. Add a line 'extension=php_memcache.dll'## to C:\winnt\php.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 connected IP address, the default is the local machine -d start start memcached service -d restart restart memcached service -d stop| shutdown Shut down the running memcached service -d install Install the memcached service -d uninstall Uninstall the memcached service -u Run as (only valid when running as root) -m Maximum memory usage, in MB. Default 64MB -M Returns an error when memory is exhausted, instead of deleting items -c Maximum number of simultaneous connections, the default is 1024 -f Block size growth factor, the default is 1.25 -n Minimum allocated space,

key+value +flags defaults to 48 -h Display 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(&#39;key&#39;, &#39;This is a test!&#39;, 0, 60);
$val = $mem->get(&#39;key&#39;);
echo $val;
?>

The above is the detailed content of Detailed tutorial on Memcache installation under Windows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn