Home  >  Article  >  Backend Development  >  PHP configuration memcache caching method_PHP tutorial

PHP configuration memcache caching method_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:10:20823browse

The article briefly introduces the method of configuring memcache cache in PHP and detecting whether the configuration is successful. Beginners can refer to it.

1. Download memcache and put it under your own drive letter. For example: d:memcached

2. Start->cmd-> Enter the command d:memcachedmemcached.exe -d install to install

3. After the installation is complete, enter d:memcachedmemcached.exe -d start

4. Download php_memcache.dll, and pay attention to placing your php version file under ext/ under your php

5. Add a line extension=php_memcache.dll to php.ini

6. Restart apache and check if there is memcache in your phpinfo. If there is, it means the installation is successful

7. Test code

php_memcache.dll download: php_memcache-cvs-20090703-5.3-VC6-x86.zip
The code is as follows
 代码如下 复制代码

$mem = new Memcache;
$mem->connect("127.0.0.1",11211);
$mem->set('key','test memcache successfull',0,100);
$val=$mem->get('key');
echo $val;
?>

Copy code

$mem = new Memcache;
$mem->connect("127.0.0.1",11211);
$mem-> set('key','test memcache successfull',0,100);
$val=$mem->get('key');
echo $val;
?>

If "test memcache successfull" is output, the installation is successful.

memcache installation file download: memcached-1.2.1-win32.zip

http://www.bkjia.com/PHPjc/444735.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/444735.html
TechArticle
The article briefly introduces the method of configuring memcache cache in PHP and detecting whether the configuration is successful. Beginners can refer to it. 1. Download memcache and put it under your own drive letter. For example: d:mem...
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