This article mainly introduces the IIS environment under Win2008 R2 64Bit Installation memcache and memcached server-side methods, friends in need can refer to the following
If you need memcache's caching support in an IIS+PHP environment. You need to install the server and client!
1. Install the memcached server
1. First download the memcached server. The download address below includes 32-bit and 64-bit versions. You can refer to your own System to download:
This is the version under windows. The installation must be installed under the command line.
You can unzip it to the C drive or other drives. For example, mine is the D drive memcached directory, and then enter cmd command line, as follows:
Microsoft Windows [版本 5.2.3790] (C) 版权所有 1985-2003 Microsoft Corp. C:\Documents and Settings\Administrator>d: D:\>cd memcache144 D:\memcached144>memcached.exe -d install (安装为服务) D:\memcached144>memcached.exe -d start (启动) C:\memcached44>
In this way, you can see the memcache.exe process in the process. In this way, it will start automatically every time it starts.
Memcached and some other commonly used commands are as follows:
The code is as follows:
-p 监听的端口 -l 连接的IP地址, 默认是本机 -d start 启动memcached服务 -d restart 重起memcached服务 -d s top |shutdown 关闭正在运行的memcached服务 -d install 安装memcached服务 -d uninstall 卸载memcached服务 -u 以的身份运行 (仅在以root运行的时候有效) -m 最大内存使用,单位MB。默认64MB -M 内存耗尽时返回错误,而不是 删除 项 -c 最大同时连接数,默认是1024 -f 块大小增长因子,默认是1.25 -n 最小分配空间, key +value+flags默认是48 -h 显示帮助
After installing according to the above installation steps, use After using memcached -m 200 to adjust the maximum memory usage, you will find that it does not work. The default memory is always 64MB. After searching on the Internet, the reason is that there is no information written in the registry, which can be modified in this way.
1. memcached -d shutdown First shut down the memcached service.
2. Enter the registry and find
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server
. There is an ImagePath entry with the value "d:\memcached144\memcached.exe" -d runservice, followed by
-p 11211 -l 127.0.0.1 -m 256 -c 2048
2. Install the memcache client
2. Download the php_memcache corresponding to the php version.dll (the one I use here The php version is: php-5.4.15-nts-Win32-VC9-x86.zip)
Then unzip it and copy the php_memcache.dll inside to your php ext directory, for example, mine is
"d:\php\ext" directory, load php_memcache.dll for php
3, configure php.ini
in PHP's configuration In file : Add the following code to the bottom of php.ini:
[memcache] extension = php_memcache.dll
4. Restart IIS, and then check phpinfo. If there is memcache, it means the installation is successful. !
Test:
<?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; ?>
The above is the detailed content of Detailed explanation of how to install memcache and memcached server in IIS environment under Win2008 R2 64Bit. For more information, please follow other related articles on the PHP Chinese website!