Php memcache installation and precautions

Source: Internet
Author: User

Install php Tutorial extension: Steps for memcache in windows

1. Download php extension dll: http://downloads.php.net/pierre/

2. Put. dll under the extension directory of php, which is generally in the ext folder of the php directory.

3. Modify php. ini in the bin folder under the apache Directory, and add extension = php_memcache.dll.

4. Restart the apache server and use phpinfo () to check whether the memcache configuration is correct.

It is worth noting that:

You must pay attention to the php compilation version. When downloading memcache, pay attention to the same compilation version. For example, if php is compiled using vc6, memcache should also be compiled using vc6.

Next, let's take a look at the download and installation of memcache php in windows.

Install memcache in windows:
1. Download the stable version of memcache for windows and decompress it to a disk, for example, in c: memcached
2. Enter 'C: memcachedmemcached.exe-d install' on the terminal (that is, the cmd command interface) to install
3. Enter 'C: memcachedmemcached.exe-d start' to start. Note: In the future, memcached will be used as a windows service and will be automatically started every time it is started. In this way, the server has been installed.
4. Download php_memcache.dll. Find the corresponding php version file by yourself.
5. Add a line 'extension = php_memcache.dll 'to c: winntphp. ini'
6. Restart apache and check phpinfo. If memcache exists, the installation is successful!


Basic settings of memcached:

-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

Test the memcache environment:
Run the following php file. If this is a test! is output !, Indicates that the environment is successfully set up. Start to appreciate the charm of memcache!

<? Php
$ Mem = new memcache;
$ Mem-> connect ("127.0.0.1 & prime;, 11211 );
$ Mem-> set ('key', 'This is a test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
?>

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.