linux安装memcached及memcache扩展
一、安装libevent函数库
下载地址:http://libevent.org
默认被安装到:/usr/local/lib目录下
安装memcached之前需要先安装libevent函数库。
可以通过#ls -al /usr/local/lib | grep libevent命令查看是否已安装libevent函数库。
如果没安装,则需下载并安装libevent函数库。
二、安装memcached
下载地址:http://memcached.org
默认被安装到:/usr/local/bin目录下
安装完毕后,
先将libevent包路径加入/etc/ls.so.conf文件中
#vi /etc/ld.so.conf
在最后面一行加入/usr/local/lib
完成后输入以下命令启动memcached主程序
/usr/local/bin/memcached -d -m 1024 -u root -l 需要访问memcached的客户端ip地址 -p 11211 -c 1024 -P /tmp/memcached.pid
常用启动参数如下:
-m:最大使用内存,以MB为单位,默认64。
-p:进程所使用的TCP进程端口,默认11211。
-d:将memcached作为后台守护进程运行。
-u:启动用户。
-P:进程文件存放路径。
-c:最大运行并发数,默认1024。
-l:监听服务地址(即允许telnte登录的IP)。
如果出现以下报错:error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
则说明memcached找不到libevent的位置,解决办法及原因如下:
原因之一:虽然刚刚我们在/etc/ls.so.conf文件里添加了libevent包目录,但系统还没有识别到这个新的动态链接库。
解决办法:我们需要执行一下ldconfig命令,这个命令通常在系统启动时运行,而当用户安装了一个新的动态链接库时,就需要手工运行这个命令。
这个命令的用途:默认搜寻/lilb和/usr/lib,以及配置文件/etc/ld.so.conf内所列的目录下的库文件。
启动完成后,可查看memcached主程序是否存在
#pstree | grep mem
三、安装memcache扩展
下载地址:http://pecl.php.net/package/memcache
memcache是php的一个扩展模块,安装前应先保证目前具备php环境。
先找到phpize的存在目录(如果是通过yum安装的php,则存在于/usr/bin中,如果没找到它们,则#yum install php-devel并重启)
解压memcache压缩包后,“进入解压出的文件夹中”。接下来使用phpzie将memcache编译到php扩展模块中。
#/usr/bin/phpize
#./configure --with-php-config=/usr/bin/php-config
(此时如果error: memcache support requires ZLIB报错,则说明没有zlib,可以yum一个,之后重启:#yum install -y zlib.x86_64 zlib-devel.x86_64)
检测成功后就可以用make编译memcache了:
#make
#make install
Installing shared extensions: /usr/lib64/php/modules/
(上面的结果表示:扩展将被安装到/usr/lib64/php/modules/目录)
最后还需要修改php.ini配置项,过程如下:
#vim /etc/php.ini
(在700多行找到下面的命令,将注释去掉,有些没有也可手动添加)
extension_dir = "/usr/lib64/php/modules/"
extension = "memcache.so"
extension = "pdo_mysql.so"
重启服务器
可以用#telnet memcached所在服务器ip地址 11211
来查看是否可以连接memcached
之后可以通过phpinfo函数查看memcache的配置信息

linux安装memcached及memcache扩展的更多相关文章
- linux下给php安装memcached及memcache扩展(转)
http://kimi.it/257.html (另外的方法)linux安装memcached及memcache扩展一.安装libevent函数库下载地址:http://libevent.org默认被 ...
- linux安装memcached和php的memcache扩展 (已使用)
所需软件libevent-1.4.6-stable.tar.gz (http://monkey.org/~provos/libevent/)memcache-2.2.3.tgz (http://pec ...
- linux下php7安装memcached、redis扩展
linux下php7安装memcached.redis扩展 1.php7安装Memcached扩展 比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 memcache ...
- linux centos 安装php的memcache扩展
一.centos6.5 yum安装php的memcache扩展 搜索memcache yum search memcache 有了,现在可以安装了 yum -y install memcached m ...
- centos'的yum安装php的memcache扩展
centos'的yum安装php的memcache扩展 博客分类: linux 让php能使用memcached服务的扩展有两种:memcache 和 memcached 1. 先安装libmem ...
- 安装php的memcache扩展
linux: 安装环境 RHEL 4 Php 5.2.6 所需软件 libevent-1.4.6-stable.tar.gz (http://monkey.org/~provos/libevent/) ...
- ubuntu下安装memcached与php扩展测试使用
1,memcached需要libevent,所以要先安装它 下载地址:http://download.chinaunix.net/download.php?id=45065&ResourceI ...
- 安装PHP及Memcache扩展
安装PHP及Memcache扩展 地址:http://blog.csdn.net/poechant/article/details/6802312 1. 下载 (1)libevent 官方网页:h ...
- window下安装php7的memcache扩展
安装memcache:http://www.runoob.com/memcached/memcached-connection.html1.4.4 c:\memcached\memcached.exe ...
随机推荐
- Codeforces Round #333 (Div. 1) D. Acyclic Organic Compounds trie树合并
D. Acyclic Organic Compounds You are given a tree T with n vertices (numbered 1 through n) and a l ...
- 移动 Web 开发技巧
1.使用click会出现绑定点击区域闪一下的情况,解决:给该元素一个样式如下 -webkit-tap-highlight-color: rgba(0,0,0,0); 2.用iphone或ipad浏览很 ...
- $(function(){})与window.onload的区别
不太一样window.onload是在页面所有的元素都加载完成后才触发$(function(){})是在页面的dom结构加载完毕后就触发 dom里的内容不一定都已经加载完成比如说一个页面有好多图片 而 ...
- 使用Hue上传hive数据
大概逻辑是先上传hdfs数据,然后创建hive外部表,关联到hdfs上传数据的位置. 截图比较概要,但是用起来很简单 1.创建路径和上传文件 2.创建外部表
- js倒计时(可定义截止日期)
<div id="times_wrap" class="time_num"> 距离结束时间: <div class="time_w& ...
- 去除手机端a标签等按下去背景色
a,button,input,textarea,label,i,em{/*highlight*/ -webkit-tap-highlight-color: rgba(255,0,0,0); borde ...
- Delphi7 客户端调用WebService(天气预报)
客户程序:第一步:新建一个Application. 第二步:File----->New----->Other------>WebServices----->WSDL Impor ...
- Robotium原理初探
本文转载于:http://blog.csdn.net/jack_chen3/article/details/41927395 测试框架图: Android测试环境的核心是Instrumentation ...
- Jenkins基础 - 常用配置操作
1.修改jenkins的根目录,默认地在C:\Users\用户名\.jenkins下(win7) 或C:\Documents and Settings\用户名\.jenkins(xp) 修改步骤: 增 ...
- HTML5中createPattern()
定义和用法 createPattern() 方法在指定的方向内重复指定的元素. 元素可以是图片.视频,或者其他 <canvas> 元素. 被重复的元素可用于绘制/填充矩形.圆形或线条等等. ...