Home  >  Article  >  Backend Development  >  windows环境下php配置memcache的具体操作步骤_PHP

windows环境下php配置memcache的具体操作步骤_PHP

WBOY
WBOYOriginal
2016-06-01 12:06:25732browse

memcache

首先要安装好php和apache环境。
我用的是wamp整合的套件
php 5.2.8
apache 2.2.1.1
这些都准备好了后,
就到 memcache 官网去下载 windows 下的 memcache.exe 这个程序

然后把他放在 c:\memcache 目录下
打开 cmd 命令 输入
cd c:\memcache

安装
memcache.exe -p install

安装完成后
memcache.exe -p start

成功开启 memcache后

就到 php/ext 目录下 把 php_memcache.dll 放到里面

然后在 php 目录下的 php.ini 增加一段内容
extension=php_memcache.dll

加完之后,重启 apache

然后 在php页面输出phpinfo();

检查 memcache 是否成功加载了。


如果成功加载了 ,就可以 在一个php页面做 memcache测试了

//phpinfo();

$memcache = new Memcache;
$memcache->connect('127.0.0.1',11211) or die('shit');

$memcache->set('key','hello memcache!');

$out = $memcache->get('key');

echo $out;

成功的话会输出

hello memcache!

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