windows下安装 memcache,包括window7报错解决方案

1. 下载 memcached-1.2.0-win32

2. 复制到某个目录,我这里复制到 D:/php/目录下了

3. 然后开始安装

windows下安装 memcache,包括window7报错解决方案

4. 启动

windows下安装 memcache,包括window7报错解决方案

5. 我的PHP是5.2.x,下载的是http://downloads.php.net/pierre/php_memcache-5.2-Win32-vc6-x86-20090408.zip 下载后复制php_memcache.dll文件到到PHP的ext目录

6. 然后在php.ini中添加一行extension=php_memcache.dll

7. 重启apache,看到memcache模块就算安装成功了。

8. 可以写个测试文件测试一下memcache 是否存在。

$mc = new Memcache;

$mc->connect('127.0.0.1', 11211) or die ("Could not connect");

$vs = $mc->getVersion();

echo "Server's version: ".$vs;

//output: Server's version: 1.2.1


windows7 安装的时候会报错:

运行 memcached.exe -d install

报错“ failed to install service or service already installed”

解决方案:

1. 找到cmd.exe 管理员运行 我的cmd.exe 在C:\\Windows\\System32\\cmd.exe 中

2. 在执行如上操作

memcached的基本设置:

-p 监听的端口

-l 连接的IP地址, 默认是本机

-d start 启动memcached服务

-d restart 重起memcached服务

-d stop|shutdown 关闭正在运行的memcached服务

-d install 安装memcached服务

-d uninstall 卸载memcached服务

-u 以的身份运行 (仅在以root运行的时候有效)

-m 最大内存使用,单位MB。默认64MB

-M 内存耗尽时返回错误,而不是删除项

-c 最大同时连接数,默认是1024

-f 块大小增长因子,默认是1.25

-n 最小分配空间,key+value+flags默认是48

-h 显示帮助


分享到:


相關文章: