Basics
The memcache sonsists of 2 parts: the server MemCached and the client MemCache.
- MemCached is the cache server, the same as Mysqld (mysql server), which save and feed cache to clients.
- MemCache is a client. With php, we need to install it as a mod, just the same as pdo_mysql (php_pdo_mysql.dll on windows).
Install MemCached
- Download memcached from http://code.jellycan.com/memcached/ (get the win32 binary version). Here we suppose you extract the memcached in d:\memcached\.
- If you are on Sindows Vista/7, rightclick on memcached.exe and select Properties; click on the Compatibility tab. At the bottom you’ll see Privilege Level, check “Run this program as an administrator”.
- Open the command line by Win + R (or Start -> All Programs -> Accessories -> Command Prompt), and then run:
d:\memcached\memcached.exe -d install
to install the service. - Still in the command line, run
d:\memcached\memcached.exe -d start
, ornet start "memcached Server"
to start the service. - Check whether the service is running. Open Windows Task Manager, go to Services tab, you should find status of “memcached server” is “Running”.
Install MemCache php module
- Download memcache. Win 32 bit version: http://downloads.php.net/pierre/ and 64 bit version:http://www.anindya.com/php-5-3-3-x64-64-bit-for-windows/ (choose Memcache 2.2.6 VC9 x64 Thread Safe).
- Extract memcache to you WAMP php ext folder, for example: D:\wamp\bin\php\php5.3.4\ext.
- Edit your php.ini file by adding:
extension=php_memcache.dll
. - Restart apache server.
- Check
php_info();
and you will find a module “memcache”.
Note
- To change MemCached memory size (default is 64mb), go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server in your registry, find the ImagePath entry and change it to:
“C:\memcached\memcached.exe” -d runservice -m 512
- More details see:
memcached -help
- Previous Entry: java client with multi entry
- Next Entry: .htaccess rewrite to redirect non-www to www
老外的文章,其中有文件下载必须翻墙,已经转存到金山快盘。
http://www.kuaipan.cn/file/id_14162220866871596.htm