PHP头条
热点:

windows/linux/php中memcached.exe的安装与配置


文章介绍了关于windows+php中memcached.exe的安装与配置和liunx中 memcached配置 ,大家可根据自己的系统来方法一或方法二来配置哦。

windows+php中memcached.exe的安装与配置

1.Windows版本的下载地址为: http://code.jellycan.com/memcached/

将压缩文件解压到  c:/memcached/

2. 在CMD下输入 “c:/memcached/memcached.exe -d install” 安装。

3. 再输入:”c:/memcached/memcached.exe -d start” 启动。NOTE:以后memcached将作为windows的一个服务每次开机时自动启动。这样服务器端已经安装完毕了。

4.若指定了 -m,则表示缓存大小为 -m后的数字,单位是 M,例如:

c:/memcached/memcached.exe –l  127.0.0.1  –m  32   – d start

如下设置memcached使用内存问题帮助:

按照上面的安装步骤安装之后,使用memcached –m 200来调整最大内存占用之后会发现没有起作用,总是默认的64MB的内存,在网上搜了一下,原因是注册表中并没有写入信息,可以这样来修改。

1. memcached –d shutdown 首先关闭memcached服务。

2.进入注册表,找到 HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/memcached Server, 在其中有一个ImagePath项,值为 “c:/memcached/memcached.exe” -d runservice,在后面加上 -l 127.0.0.1 -m 3000 -c 2048。

3.memcached –d start 启动memcached服务,这样就将memcached的最大内存修改为了3000MB。

如果下载的是二进制的版本,直接运行就可以了,可以加上参数来加以设置。

常用设置:

-p <num>          监听的端口
-l <ip_addr>      连接的IP地址, 默认是本机
-d start          启动memcached服务
-d restart        重起memcached服务
-d stop|shutdown      关闭正在运行的memcached服务
-d install        安装memcached服务
-d uninstall      卸载memcached服务
-u <username>     以<username>的身份运行 (仅在以root运行的时候有效)
-m <num>          最大内存使用,单位MB。默认64MB
-M                内存耗尽时返回错误,而不是删除项
-c <num>          最大同时连接数,默认是1024
-f <factor>       块大小增长因子,默认是1.25
-n <bytes>        最小分配空间,key+value+flags默认是48
-h                显示帮助

linux+php中memcached.exe的安装与配置

首页
http://www.danga.com/memcached

下载地址:
http://danga.com/memcached/download.bml

下载文件
memcached-1.2.6.tar.gz
tar zxvf memcached-1.2.6.tar.gz
./configure --prefix=/usr/local/memcached-1.2.6
make
make install

注意:

memcache需要这个包libevent,不然安装时要报错:

checking for libevent directory... configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

下载得到文件libevent-1.4.9-stable.tar.gz

tar zxvf libevent-1.4.9-stable.tar.gz

./configure --prefix=/usr/local/libevent-1.4.9-stable.tar.gz
make
make install

由于我安装没有安装在usr下面,所以最后启动memcache报错:

[root@localhost bin]# ./memcached -d -m 10 -p 11211 -u root -l 0.0.0.0
./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

检查libevent安装情况:

ls -al /usr/lib | grep libevent
把 libevent-1.4.so.2 拷贝/链接到 /usr/lib 中,否则 memcached 无法正常加载。

cp libevent-1.4.so.2 /usr/lib/

文章出处:http://www.diybl.com/course/6_system/linux/linuxjq/20071010/77432.html


安装完之后要启动服务
cd /usr/local/memcached-1.2.6/bin
./memcached -d -m 50 -p 11211 -u root -l 0.0.0.0
参数说明
-m 指定使用多少兆的缓存空间;
-p 指定要监听的端口;
-u 指定以哪个用户来运行

www.phpzy.comtrue/php/33618.htmlTechArticlewindows/linux/php中memcached.exe的安装与配置 文章介绍了关于windows+php中memcached.exe的安装与配置和liunx中 memcached配置 ,大家可根据自己的系统来方法一或方法二来配置哦。 windows+php中memcach...

相关文章

    暂无相关文章

PHP之友评论

今天推荐