一、安装libevent
# wget http://www.monkey.org/~provos/libevent-2.0.12-stable.tar.gz
# tar zxf libevent-2.0.12-stable.tar.gz 
# cd libevent-2.0.12-stable
#./configure  --prefix=/usr/local/lib
# make && make install

二、下载安装最新版本:http://memcached.org/downloads
# wget http://memcached.org/files/memcached-1.4.20.tar.gz

# cd memcached-1.4.20

#./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/lib && make && make install

三、配置启动

# vi /etc/rc.local  

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local

/usr/sbin/ntpdate ntpupdate.tencentyun.com >/dev/null 2>&1 &
/usr/local/agenttools/agent/startagent.sh  /usr/local/agenttools/agent /dev/null

#secu-tcs-agent bootstart, install at Tue Apr 29 17:21:38 CST 2014.
/usr/local/sa/agent/secu-tcs-agent-mon-safe.sh > /dev/null 2>&1

/usr/local/memcached/bin/memcached -p 12677 -U 0 -d -r -u root -m 2040 -c 1024 -t 4

保存后退出,手动启动服务

# /usr/local/memcached/bin/memcached -p 12677 -U 0 -d -r -u root -m 2040 -c 1024 -t 4

注:如果出现/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory异常在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。

# vi /etc/ld.so.conf

#  /sbin/ldconfig -V

四、测试memcached

# telnet 127.0.0.1 12677

出现以下信息表示启动成功
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

Linux下php安装memcache扩展

安装环境:CentOS 6.4

PHP扩展memcache的作用是为了支持memcached数据库缓存服务器,下面是安装方法。

1、下载

下载地址:http://pecl.php.net/package/memcache

文件名:memcache-3.0.8.tgz

文件下载成功后上传至/usr/local目录

2、安装

[root@vm15 local]# tar -zxvf memcache-3.0.8.tgz
root@vm15 local]# cd memcache-3.0.8
[root@vm15 memcache-3.0.8]# /usr/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@vm15 memcache-3.0.8]# ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir  或者直接./configure
[root@vm15 memcache-3.0.8]# make
[root@vm15 memcache-3.0.8]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@vm15 memcache-3.0.8]# ll /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

total 2140
-rwxr-xr-x. 1 root root 453766 Dec 30 17:44 memcache.so
-rwxr-xr-x. 1 root root 861055 Dec 30 16:47 Redis.so

出现memcache.so就表明安装成功了

 tips:

     configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located

     yum 安装     #yum install zlib-devel

3、配置支持php

[root@vm15 memcache-3.0.8]# vi + /usr/local/php/lib/php.ini
添加
extension=memcache.so
:wq! #保存退出

4、重启服务

#/etc/init.d/php-fpm restart

linux安装memcache及memcache扩展的更多相关文章

  1. linux安装memcached及memcache扩展

    一.安装libevent函数库 下载地址:http://libevent.org 默认被安装到:/usr/local/lib目录下 安装memcached之前需要先安装libevent函数库. 可以通 ...

  2. linux安装配置Redis,Swoole扩展

    我是使用的是lnmp环境(php5.6.3) 一.安装redis数据库(参考w3c手册) 下载地址:http://redis.io/download 本教程使用的最新文档版本为 2.8.17,下载并安 ...

  3. Linux安装PHP的Redis扩展(已安装Redis)

    1.下载需要的php操作redis的扩展包 下载地址 http://pecl.php.net/package/redis    下载对应php版本,我的php版本为7.3,下载的是最新的版本5.0.2 ...

  4. Linux安装php的Redis扩展

    1.安装redis 下载:https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz 上传phpredis-2.2.4.tar.gz到/usr ...

  5. linux 安装 ImageMagick 和 imagick 扩展

    使用命令安装 1.依次运行以下命令 yum install ImageMagick yum install ImageMagick-devel yum install php-pear 安装php-p ...

  6. linux下给php安装memcached及memcache扩展(转)

    http://kimi.it/257.html (另外的方法)linux安装memcached及memcache扩展一.安装libevent函数库下载地址:http://libevent.org默认被 ...

  7. Linux下的Memcache安装及安装Memcache的PHP扩展安装

    Linux下Memcache服务器端的安装服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-1.3.0 .下载:http://www.danga.com/memcach ...

  8. Linux安装php扩展memcache

    Linux安装php扩展memcache   php扩展memcache的作用是为了支持memcached数据库缓存服务器,下面是安装方法.1.下载并解压memcache文件 wget -c http ...

  9. Linux 安装基于(PHP5.5)memcache扩展

    一. memcache服务器端 下载地址:http://memcached.org/ 安装memcached,同时需要安装中指定libevent的安装位置 tar zxvf memcached-1.2 ...

  10. linux centos 安装php的memcache扩展

    一.centos6.5 yum安装php的memcache扩展 搜索memcache yum search memcache 有了,现在可以安装了 yum -y install memcached m ...

随机推荐

  1. Windbg基本命令应用总结

    .cordll -ve -u -l //reload core dlls ------加载下载系统文件符号的URL---------- .sympath SRV*C:\Symbols*http://m ...

  2. 第一章IP:网际协议

    I P是T C P / I P协议族中最为核心的协议.所有的 T C P.U D P.I C M P及I G M P数据都以I P数据报格式传输(见图 1 - 4).许多刚开始接触 T C P / I ...

  3. vue表单验证--veevalidate使用教程

    vue表单验证----vee-validate使用教程 官网:https://baianat.github.io/vee-validate/ 一.安装 npm install vee-validate ...

  4. jquery 三元运算

    三元运算: 条件  ? 条件为真取此值 : 条件为假取此值; var v = $(:check).prop('checked')?faule:true; $(:check).prop('checked ...

  5. Spring Boot实践——SpringMVC视图解析

    一.注解说明 在spring-boot+spring mvc 的项目中,有些时候我们需要自己配置一些项目的设置,就会涉及到这三个,那么,他们之间有什么关系呢? 首先,@EnableWebMvc=Web ...

  6. MyBatis 学习记录2 Mapper对象是如何生成的

    主题 以前我一直有一个问题不懂.并且觉得很神奇.就是Mybatis我们开发的时候只需要定义接口,并没有写实现类,为什么我们运行的时候就可以直接使用? 现在我想分享下这部分大致是怎么实现的. 在启动的时 ...

  7. MySQL数据库篇之初识数据库

    主要知识点: 一.数据库概述 二.mysql安装与基本管理 1️⃣ 数据库概述 1.什么是数据(Data)? 描述事物的符号记录称为数据,描述事物的符号既可以是数字,也可以是文字.图片,图像.声音. ...

  8. go cobra

    https://github.com/spf13/cobra https://github.com/spf13/cobra/blob/master/bash_completions.md go get ...

  9. 求Half向量

    [求Half向量] 给定入射向量与视角向量.把入射向量与视角向量相加即可,如下: 前提是 lightDir.ViewDir 都是单位向量.

  10. 【SPOJ - LCS2】Longest Common Substring II【SAM】

    题意 求出多个串的最长公共子串. 分析 刚学SAM想做这个题的话最好先去做一下那道codevs3160.求两个串的LCS应该怎么求?把一个串s1建自动机,然后跑另一个串s2,然后找出s2每个前缀的最长 ...