Install Memcache in windows 64-bit system

Source: Internet
Author: User
Tags install php memcached memory usage port number

Recently, to play with Memcache, we need to build a Memcache development and debugging environment in 64-bit Windows, record the process of self-installation and setup, and find that it is much easier to build than in Linux.

Here is the process of installing Memcache with 64-bit Windows 7.
1. Install PHP, Mysql, and Apache. I don't need to talk about the environment here. There are many one-click environments that almost do not affect Memcache. (My own debugging environment is PHPStudy)
2. Download and install Memcache. Here we download the 64-bit version.
Download Address: Baidu online storage (shared folder)
A) download and decompress the package and place it in the hard disk directory, for example, D: \ memcached.
Enter the command line in the runtime and enter the directory where memcached.exe is located, for example, D: \ memcached.
In the memcachedirectory, enter memcached.exe-d installand use memcached.exe as the service.
D)input memcached.exe-d start to 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 settings parameters:

-P listening port (default value: 11211)
-L connected IP address. The default value is local
-D start: start the memcached service.
-D restart: restart the memcached service.
-D stop | shutdown the running memcached service
-D install the memcached service
-D uninstall memcached service
-U runs as the identity (only valid when running as root)
-MB maximum memory usage, in MB. The default value is 64 MB.
-An error is returned when M memory is used up, instead of deleting items.
-C: maximum number of simultaneous connections. The default value is 1024.
-F block size growth factor, default value: 1.25
-N: Minimum allocation space. The default value of key + value + flags is 48.
-H Show Help
Note: The Port modification via commands in the experiment is invalid. The corresponding solution is to modify the registry to modify the port and configuration.
The value I modified myself is as follows: (maximum memory size: 1024 MB, maximum number of connections: 2048, IP address: 127.0.0.1,the port number is. The effective value is to restart the memcached.exe service)
Go to the registry and find the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ memcached Server, which has an ImagePath item with the value "d: \ memcached \ memcached.exe"-d runservice, add the-l 127.0.0.1-m 1024-c 2048 last ImagePath item value, which should be like this: d: \ memcached \ memcached.exe "-d runservice-l 127.0.0.1-m 1024-c 2048

Use telnet to test memcache:
Telnet 127.0.0.1 11211 (note: the configured IP address and port must be used here)
Enter stats

3. Modify the PHP. ini extension to support memcached.
Download php_memcache.dll. Find the corresponding php version file by yourself. My own PHPstudy one-click environment comes with the memcached. dll file.
You only need to modify the extension and add extension = php_memcache.dll.
4. Restart Apache and check phpinfo. If memcache exists, the installation is successful.

5. Simple test of memcache running

The code is as follows: Copy code
<?
$ Memcache = new Memcache;
$ Memcache-> connect ("127.0.0.1", 11211 );
Echo "Server's version:". $ memcache-> getVersion (). "<br/> \ n ";
$ Memcache-> set ('key', 'This is a test! ', 0, 60 );
$ Val = $ memcache-> get ('key ');
Echo $ val;
?>

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.