首先要安装好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!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号