PHP memcache extension installation for Windows, phpmemcache

Source: Internet
Author: User
Tags couchbase

PHP memcache extension installation for Windows, phpmemcache

1. download and install the memcached server software

1. Download memcached Software

Memcached-win32-1.4.4-14.zip(download link directly, memcached-win32-1.4.4-14.zip download page: http://blog.couchbase.com/memcached-144-windows-32-bit-binary-now-available

64-bit: memcached-win64-1.4.4-14.zip(download directly, memcached-win64-1.4.4-14.zip download page: http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

I use wamp, a 64-bit computer. Download the memcached server software package.

Decompress the package to the specified directory. I chose D: \ memcached.

2. Install memcached

Run cmd.exe as an administrator and go to the folder where memcached is located. And install memcached.

No prompt is displayed after installation.

3. Start the memcached service.

Run the memcached command in cmd.exe as follows:

memcached.exe -d start

Then, go to the task manager process to check whether the memcached service has been started.

 

4. memcached basic parameter settings
-P listening port
-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

5. memcached stop and unmount commands

1 D:\memcached> memcached.exe -d stop2 D:\memcached> memcached.exe -d uninstall

 

II,Install memcache extension in PHP

1. Download memcache. dll extension

: Http://pecl.php.net/package/memcache/3.0.8/windows

Download Note: select the version that matches your environment and the thread security version.

My local wamp2.5 php version is 5.5 Windows 64-bit, so the download is 5.5 Thread Safe (TS) x64

2. decompress the package after the download is complete, as shown in.

Copy the php_memcache.dll extension file to the php extension directory, for example (D: \ wamp \ bin \ php \ php5.5.12 \ ext)

3. Modify the php. ini file

Open the php. ini file in php (My address is: D: \ wamp \ bin \ apache \ apache2.4.9 \ bin \ php. ini)

Add a line of code:

extension=php_memcache.dll

  

Note: a semicolon (;) is not allowed before a new row. The semicolon represents the comment point, which cannot be used.

 

After saving it, restart the server (apache, nginx, or iis) and I will simply restart wamp.

Enter http: // localhost/? in the browser /? Phpinfo = 1. You can see that the memcache extension has been loaded.

 

III,PHP program test whether memcache function is available locally

Create a php file test. php

<?php$memcache = new Memcache;$memcache->connect('127.0.0.1',11211) or die('shit');$memcache->set('key','hello memcache!');$out = $memcache->get('key');echo $out;

Then access the file through the browser. The normal result shows the input:

hello memcache!

Finished.

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.