Install Memcache cache _php instance under 64-bit Windows system

Source: Internet
Author: User
Tags install php memcached memory usage valid

Recently to play memcache, so you need Windows 64-bit to build a memcache development and debugging environment, record their own installation and build the process, found that more than Linux to build a much simpler.

This is the process I use Windows 7 64Bit to install Memcache

1, install PHP, MySQL and Apache, this environment I do not have to do more introduction, a key environment has a lot, almost do not affect memcache. (My own debugging environment is Phpstudy)

2, download and install memcache, I download here is a 64-bit version.

Download Address: http://www.jb51.net/softs/205839.html
A the download after decompression placed in the directory of the hard disk, such as: D:\memcached.
b then enter cmd into the command line in the run and enter the directory where Memcached.exe is located, for example: D:\memcached
C then in the Memcache directory, enter memcached.exe–d install, add memcached.exe for service
D Enter memcached.exe-d start and run the memcached program.

C:\users\test>d:
d:\>cd d:\memcache
d:\memcache>memcached.exe-d Install
d:\memcache> memcached.exe-d start   

memcahed Basic setup parameters:

-P Listening Port (default is 11211)-
l connected IP address, default is native-
D start memcached service-
d restart Restart memcached service-D
Stop|shutdown Shut down the running memcached service-
d install install memcached service-
d uninstall Uninstall memcached Service----
Run as-u (only valid when run as root)-
m Maximum memory usage, in MB. The default 64MB
-M memory exhaustion Returns an error instead of deleting item
-c maximum simultaneous connections, default is 1024-
f block size growth factor, default is 1.25
-n Minimum allocation space, key+value+flags default is 48 -
h Display Help

Note: The test using the command to modify the port is not valid, the corresponding solution is to modify the registry to achieve this modification port and configuration purposes.
My own modified values are as follows: (Maximum memory size 1024M, maximum number of connections: 2048,ip Address: 127.0.0.1, port default is 11211, the need to restart the Memcached.exe service)
Enter the registry to locate the Hkey_local_machine\system\currentcontrolset\services\memcached Server, where there is a ImagePath entry, the value is "d:\memcached\ Memcached.exe "-D runservice, followed by-L 127.0.0.1-M 1024-c 2048 The last ImagePath item value should be like this: D:\memcached\memcached.exe"-D runse Rvice-l 127.0.0.1-m 1024-c 2048

Use the Telnet test to Memcache:
Telnet 127.0.0.1 11211 (Note: You need to use the IP and port settings here)
Input stats

3, modify php.ini extension support memcached.

Download Php_memcache.dll, please find the corresponding PHP version of the file. I used my own phpstudy in a key environment with Memcached.dll files.
Just modify the extension, plus Extension=php_memcache.dll

4, restart Apache, and then check phpinfo, if there is memcache, then the installation is successful

5. Simple Test memcache operation

?
$memcache = new Memcache;
$memcache->connect ("127.0.0.1", 11211);
echo "Server ' version:". $memcache->getversion (). "<br/>\n";
$memcache->set (' key ', ' This is a test! ', 0);
$val = $memcache->get (' key ');
echo $val;
? >

Appears after running:
Server ' s version:1.4.2
This is a test!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.