Install and configure memcache and memcached in Windows

Source: Internet
Author: User
Tags crc32
1: Download

Php_memcache-2.2.6-5.3-vc9-x86.zip

Memcached-1.2.6-win32-bin.zip


2: unzip the configuration

A. memcache

Decompress the package to obtain php_memcache.dll and compiled memcached.exe.

Open your PHP/EXT and copy php_memcache.dll. For example, I copied it to F:/PHP/PhP5/Ext.

Open PHP. ini, find extension, and add

extension=php_memcache.dll

Save and copy the file to the. C:/Windows directory.

Restart Apache.

B. memcached

Copy memcached.exe to any directory and I put it to F:/PHP/mem.

Run the command "F:/PHP/mem" in cmd. (If You Want To uninstall the command, change "Install" to "Uninstall)

memcached.exe -d install

Enable service command line Input

net start "memcached Server"

Open the task manager and you can see the process of memcached.exe.

Start command line Input

F:/PHP/MEM/memcached.exe-d start

You can add parameters above. Specify memory division-m 200, IP listening-l 192.168.1. *, and port number-P 11211.

For details, refer to the memcached PHP manual. Address here. http://php.net/manual/en/book.memcached.php page has a Chinese version.

Go to telnet localhost 11211

Enter. Enter version to view version, and enter stats to view status

3: Open phpinfo. php In the browser

You can find memcache.

Memcache
Memcache support Enabled
Active persistent connections 0
Version 2.2.6
Revision $ Revision: 296899 $


Directive Local Value Master Value
Memcache. allow_failover 1 1
Memcache. chunk_size 8192 8192
Memcache. default_port 11211 11211
Memcache. default_timeout_ms 1000 1000
Memcache. hash_function CRC32 CRC32
Memcache. hash_strategy Standard Standard
Memcache. max_failover_attempts 20 20

Create a PHP file, such as my testmemcache. php

<? PHP $ mem = new memcache; $ mem-> connect ("localhost", 11211); // pconnect persistent link // $ mem-> addserver ("www.test.com", 11221 ); // Add multiple servers. // $ mem-> addserver ("192.168.1.9", 11211); $ mem-> Add ("mystr", "This is a memcache test! ", Memcache_compressed, 3600); $ STR = $ mem-> get (" mystr "); echo" string :". $ Str. "<br/>"; $ mem-> Add ("myarr", array ("AAA", "BBB", "CCC", "DDD ")); print_r ($ mem-> get ("myarr"); echo '<br/>'; Class testc {var $ name = "Tom"; var $ age = 5; vaR $ money = 100;} $ mem-> Add ("myobj", new testc); var_dump ($ mem-> get ("myobj ")); echo '<br/>'; echo $ mem-> getversion (). "<br/>"; echo '<PRE>'; print_r ($ mem-> getstats (); echo '</PRE> '; $ mem-> close (); ?

Open testmemcache. php in the browser.

string: this is a memcache test!Array ( [0] => aaa [1] => bbb [2] => ccc [3] => ddd ) object(TestC)[2]  public 'name' => string 'Tom' (length=3)  public 'age' => int 5  public 'money' => int 1001.2.6Array(    [pid] => 868    [uptime] => 3335    [time] => 1316167200    [version] => 1.2.6    [pointer_size] => 32    [curr_items] => 3    [total_items] => 6    [bytes] => 320    [curr_connections] => 3    [total_connections] => 15    [connection_structures] => 4    [cmd_get] => 30    [cmd_set] => 27    [get_hits] => 29    [get_misses] => 1    [evictions] => 0    [bytes_read] => 2251    [bytes_written] => 4515    [limit_maxbytes] => 67108864    [threads] => 1)

Enter get mystr, get myarr, and get myobj In the telnet interface.

4: No

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.