Home  >  Article  >  Backend Development  >  Installation and configuration tutorial of memcache under windows_PHP tutorial

Installation and configuration tutorial of memcache under windows_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:04811browse

Regarding what memcached is and how to use memcached, I won’t go into details here. Readers can refer to the articles on this site:
What is memcached? How to use memcache?
This article mainly introduces how to install and configure the memcached service in a windows environment.

(1), download the memcached program (applicable to windows 32 version)

Download the memcached-win32 version (http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip). You can also download it from the official website. The address of the memcached official website is http:/ /code.jellycan.com/memcached/, find "win32 binary: memcached-1.2.6-win32-bin.zip" and you can download it.

(2), install memcached

1. Extract the downloaded file to the c:/memcached directory, then start cmd and enter the following commands in sequence:

C:>c:/memcached/memcached.exe -d install //Install memcached
C:>c:/memcached/memcached.exe -d start //Start the memcached service
C:>telnet 127.0.0.1 11211 //Test the connection, 11211 is the default port of the memcached service

2. Then enter stats (if the following information pops up, it means memcached is successfully installed)

STAT pid 2484
STAT uptime 266
STAT time 1267938148
STAT version 1.2.1
STAT pointer_size 32
STAT curr_items 0
STAT total_items 0
STAT bytes 0
STAT curr_connections 1
STAT total_connections 2
STAT connection_structures 2
STAT cmd_get 0
STAT cmd_set 0
STAT get_hits 0
STAT get_misses 0
STAT bytes_read 23
STAT bytes_written 7
STAT limit_maxbytes 67108864
END

Note: If your system is Win 7, you may get a message similar to "'telnet' is not an internal or external command, nor is it an operable program." After investigation, this is because Win7 does not have the telnet function installed by default. So you can't use the telnet command directly. You can go to "Control Panel"--"Programs"---"Turn Windows features on or off" and check "telnet client".

(3), configure php’s memcached service

php_memcache.dll component download address: http://www.php100.com/html/download/tools/2010/0125/3858.html

Download the php_memcache.dll component, place it in the ext directory in the PHP installation directory, and then add in the PHP.ini (note that the modified file when using the phpnow server is php-apache2handler.ini) file:

extension=php_memcache.dll;

Save and exit, then restart the Apache server, and then use the phpinfo() function to check whether there is a memcached service in the service.

(4). Test whether the memcached service can run normally

<?php
$mem = new Memcache;
$mem->connect('127.0.0.1', 11211) or die ("Memcache连接失败");
echo 'Memcache 当前版本:'.$mem->getVersion().'<br>';//得到Memcache版本信息
$mem->set('content', 'hello world!');//添加一个Memcache对象
echo $mem->get('content');//获取一个key值
$mem->close();

If everything above can run normally, it means memcached has been successfully installed and configured. Next, you can use the memcached service normally.

Articles you may be interested in

  • How to install and configure PHP running environment under Windows 7
  • Installation and use of Sphinx under windows [Supports Chinese full-text search]
  • Installing memcache under windows system
  • Detailed explanation of the difference between window.navigate and window.location.href
  • How to run PHP files under the command line under windows
  • Mysql installation and configuration detailed tutorial (picture and text explanation)
  • Master-slave synchronization backup steps of mysql database in Windows environment
  • DOS command under Windows to view the programs occupying the ×× port

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764155.htmlTechArticleAbout what memcached is and how to use memcached, I won’t go into details here. Readers can refer to the article on this site: memcached What is it? How to use memcache? This article mainly introduces...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn