win10+PHP 安装memcache

1、给php环境安装memcache扩展

2、给电脑安装memcache环境

 

一、为win10安装memcache服务

 

下载对应的版本

32位系统 1.4.5版本:http://static.runoob.com/download/memcached-1.4.5-x86.zip

64位系统 1.4.5版本:http://static.runoob.com/download/memcached-1.4.5-amd64.zip

 memcached >= 1.4.5 版本安装

1、解压下载的安装包到指定目录。

2、在 memcached1.4.5 版本之后,memcached 不能作为服务来运行,需要使用任务计划中来开启一个普通的进程,在 window 启动时设置 memcached自动执行。

使用管理员身份执行以下命令将 memcached 添加来任务计划表中:

schtasks /create /sc onstart /tn memcached /tr "'c:\memcached\memcached.exe' -m 512" 

注意:你需要使用真实的路径替代 c:\memcached\memcached.exe。

注意:-m 512 意思是设置 memcached 最大的缓存配置为512M。

注意:我们可以通过使用 "c:\memcached\memcached.exe -h" 命令查看更多的参数配置。

3、如果需要删除 memcached 的任务计划可以执行以下命令:

schtasks /delete /tn memcached

 

二、php安装memcache扩展

 

1、下载系统对应的php_memcache 版本

(https://github.com/nono303/PHP7-memcache-dll)

2、下载解压后,就到 php/ext 目录下 php_memcache.dll 放到里面然后在 php 目录下的 php.ini 增加一段内容 

extension=php_memcache.dll

加完之后,重启 apache或者nginx ;然后 在php页面输出phpinfo();

检查 memcache 是否成功加载了。

3、   //新建php文件,输出 hello memcache! 就说明安装成功啦

1 <?php
2         $memcache = new Memcache;
3         $memcache->connect('127.0.0.1', 11211) or die('shit');
4         $memcache->set('key', 'hello memcache!');
5         $out = $memcache->get('key');
6         echo $out;

  

 over!over!over!

猜你喜欢

转载自www.cnblogs.com/yulongcode/p/10585275.html