Win2008 R2 64Bit the IIS environment installs the memcache and memcached server methods

  • 2020-05-15 02:56:00
  • OfStack

If the IIS+PHP environment requires memcache's caching support. Need to install the server and client side!

1. Install the memcached server

1. First download the memcached server. The following download address includes 32-bit and 64-bit.

Download address:
Baidu network location: http: / / pan baidu. com s / 1 ntyswWh password: mf6a
http://pan.baidu.com/s/1dE2EG4T

This is the version of windows, installed from the command line
Extract to C disk or other disk, such as my D disk memcached directory, and then enter the cmd command line, as follows:


Microsoft Windows [ version  5.2.3790]
(C)  All rights reserved  1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>d:

D:\>cd memcache144

D:\memcached144>memcached.exe -d install ( Install as a service )
D:\memcached144>memcached.exe -d start ( Start the )
C:\memcached44>

This allows you to see the memcache.exe process inside the process. This will automatically start each time it is started

Memcached has some other common commands as follows:


-p Listening port
-l Of the connection IP address , The default is native
-d start Start the memcached service
-d restart restart memcached service
-d stop|shutdown Close the running memcached service
-d install The installation memcached service
-d uninstall uninstall memcached service
-u Run as ( Only in the root It works when it runs )
-m Maximum memory usage, unit MB . The default 64MB
-M Returns an error when memory runs out, instead of deleting an item
-c Maximum number of simultaneous connections, default is 1024
-f Block size growth factor, by default 1.25
-n Minimum allocated space, key+value+flags The default is 48
-h Display help

After following the installation steps above, adjust the maximum memory footprint using memcached-m 200 and you will find that it does not work. The default memory is always 64MB.

1. memcached-d shutdown first shut down memcached service.

2. Enter the registry and find

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server

There is one ImagePath item, the value is "d:\memcached144\ memcached.exe "-d runservice, plus

-p 11211 -l 127.0.0.1 -m 256 -c 2048

2. Install the memcache client

2. Download php_memcache.dll (the php version I'm using here is: php-5.4.15-nts-Win32-VC9-x86.zip)
Download address:

Official address: http: / / pecl php. net package/memcache / 3.0.8 / windows

Then unzip and copy php_memcache.dll into your php ext directory, as mine is
"d:\php\ext" directory, load php_memcache.dll for php

3. Configure php.ini
In the PHP configuration file: php.ini add the following code to the bottom:

[memcache]
extension = php_memcache.dll

4. Restart IIS and check 1 for phpinfo. If there is memcache, the installation is successful!
Testing:


<?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;
?>

3. Memcached management monitoring tool

1.MemAdmin
Download address:
Baidu cloud disk: http: / / pan baidu. com s / 1 hquyMCO password: 46 bk
http://pan.baidu.com/s/1o8zUIYA
The official download: http: / / www junopen. com/memadmin /


Related articles: