Install memcache internal cache instances in the window system

Source: Internet
Author: User

Windows must support memcache and install the memcache server and client:Memcache Server Download,Download the memcache client,

First download the server and decompress it to d disk Directory D: \ memcached-1.2.1-win32, CMD to execute the command:

C/C ++ code Copy content to clipboard
    1. D: \ memcached-1.2.1-win32
    2. Memcached.exe-u administator-D install
    3. Net start"Memcached server"

Will appear

The memcache server has been successfully installed. Haha, then install the memcache client:

Copy the downloaded file to the PHP ext directory, and add a line to the php. ini file in use.

 

Extension = php_memcache.dll

 

Restart Apache and check that the memcache module is successfully installed.

 

Write countCodeTest:

 

PHP code Copy content to clipboard
    1. $ mem = New memcache;
    2. $ mem -> connect ( "localhost" , 11211);
    3. $ mem -> set ( 'key' , 'value' , 0, 60);
    4. $ Val = $ mem -> get ( 'key' );
    5. echo $ Val ; // The output result is "value".
Note: For win7, cmd.exe must run as an administrator; otherwise, the installation will fail. Note: An error may be reported during local testing. Similar:
Notice: memcache: connect () [function. memcache-connect]: Server localhost (TCP 11211) failed with: the connection attempt fails because the connection fails to respond correctly after a period of time or the host does not respond. (10060) in ***/test. php on line 4

Warning: memcache: connect () [function. memcache-connect]: Can't connect to localhost: 11211. The connection attempt fails because the connection fails to respond correctly after a period of time or the host does not respond. (10060) in ***/test. php on line 4
Cocould not connect

Solution:

Replace localhost with 127.0.0.1

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.