Home  >  Article  >  Backend Development  >  windows下安装php的memcache模块的方法_PHP

windows下安装php的memcache模块的方法_PHP

WBOY
WBOYOriginal
2016-05-30 14:59:12778browse

要求必备知识

熟悉基本编程环境搭建。

运行环境

windows 7(64位);
php-5.3;
memcached-1.2.6

下载地址

环境下载

什么是PHP Memcache模块

Memcache模块提供了于memcached方便的面向过程及面向对象的接口,memcached是为了降低动态web应用 从数据库加载数据而产生的一种常驻进程缓存产品。

下载memcache官网PHP Memcache下载地址

这里需要注意一下版本号,根据个人情况而定,我下的是php_memcache-3.0.8-5.3-ts-vc9-x86.zip

用phpinfo()函数查看当前PHP版本的信息

安装扩展

将下载下来的压缩包解压,然后将 php_memcache.dll模块拷贝到PHP的ext文件夹内。

修改php.ini文件

引入如下代码

测试

重启web服务器。

在memcache.php文件中输入如下代码:

<?php
$memcache = new Memcache;
$memcache->connect('127.0.0.1',11211);
$memcache->set('key','hello memcache!');
$out = $memcache->get('key');
echo $out;
?>

在浏览器中进行测试,这里需要注意的是memcache服务必需在启动状态下哦。关于memcache服务在windows平台的安装,可以参考我之前写的一篇文章哦。

Memcache for Windows

如以上文章或链接对你有帮助的话,别忘了在文章结尾处轻轻点击一下 “还不错”按钮或到页面右下角点击 “赞一个” 按钮哦。你也可以点击页面右边“分享”悬浮按钮哦,让更多的人阅读这篇文章。

由于本人水平有限,文章在表述和代码方面如有不妥之处,欢迎批评指正。留下你的脚印,欢迎评论哦。

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