Memcached是一个高性能的分布式内存对象缓存系统,用于动态web应用以减轻数据库的负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提拱动态 数据驱动网站的速度。

memcached是其于libevent做事件触发的,首先装libevent.

wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
[root@14LN src]# tar -xzvf libevent-2.0.21-stable.tar.gz
[root@14LN libevent-2.0.21-stable]# pwd
/usr/local/src/libevent-2.0.21-stable
[root@14LN libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent
[root@14LN libevent-2.0.21-stable]# make && make install
[root@14LN libevent-2.0.21-stable]# ls -al /app/server/libevent/lib/ |grep libevent
lrwxrwxrwx. 1 root root 21 Jul 12 20:36 libevent-2.0.so.5 -> libevent-2.0.so.5.1.9
-rwxr-xr-x. 1 root root 968450 Jul 12 20:36 libevent-2.0.so.5.1.9
-rw-r--r--. 1 root root 1571290 Jul 12 20:36 libevent.a
lrwxrwxrwx. 1 root root 26 Jul 12 20:36 libevent_core-2.0.so.5 -> libevent_core-2.0.so.5.1.9
-rwxr-xr-x. 1 root root 585065 Jul 12 20:36 libevent_core-2.0.so.5.1.9
-rw-r--r--. 1 root root 978042 Jul 12 20:36 libevent_core.a
-rwxr-xr-x. 1 root root 986 Jul 12 20:36 libevent_core.la
lrwxrwxrwx. 1 root root 26 Jul 12 20:36 libevent_core.so -> libevent_core-2.0.so.5.1.9
lrwxrwxrwx. 1 root root 27 Jul 12 20:36 libevent_extra-2.0.so.5 -> libevent_extra-2.0.so.5.1.9
-rwxr-xr-x. 1 root root 404772 Jul 12 20:36 libevent_extra-2.0.so.5.1.9
-rw-r--r--. 1 root root 593320 Jul 12 20:36 libevent_extra.a
-rwxr-xr-x. 1 root root 993 Jul 12 20:36 libevent_extra.la
lrwxrwxrwx. 1 root root 27 Jul 12 20:36 libevent_extra.so -> libevent_extra-2.0.so.5.1.9
-rwxr-xr-x. 1 root root 951 Jul 12 20:36 libevent.la
lrwxrwxrwx. 1 root root 30 Jul 12 20:36 libevent_pthreads-2.0.so.5 -> libevent_pthreads-2.0.so.5.1.9
-rwxr-xr-x. 1 root root 18470 Jul 12 20:36 libevent_pthreads-2.0.so.5.1.9
-rw-r--r--. 1 root root 18710 Jul 12 20:36 libevent_pthreads.a
-rwxr-xr-x. 1 root root 1014 Jul 12 20:36 libevent_pthreads.la
lrwxrwxrwx. 1 root root 30 Jul 12 20:36 libevent_pthreads.so -> libevent_pthreads-2.0.so.5.1.9
lrwxrwxrwx. 1 root root 21 Jul 12 20:36 libevent.so -> libevent-2.0.so.5.1.9
[root@14LN libevent-2.0.21-stable]#

接下来安装Memcached:

[root@14LN src]# wget http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz
[root@14LN src]# tar -xzvf memcached-1.4.15.tar.gz
[root@14LN src]# cd memcached-1.4.15
[root@14LN memcached-1.4.15]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[root@14LN memcached-1.4.15]# make && make install
安装php扩展模块memcache
[root@14LN src]# wget http://pecl.php.net/get/memcache-2.2.6.tgz
[root@14LN src]# cd memcache-2.2.6
[root@14LN memcache-2.2.6]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
[root@14LN memcache-2.2.6]# ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir
[root@14LN memcache-2.2.6]# make && make install 安装成功会有类似下面的提示:
Build complete.
Don't forget to run 'make test'. Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/ [root@14LN memcache-2.2.6]# egrep 'memcache|extension_dir' /etc/php.ini
[memcache]
extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"
extension=memcache.so
; extension_dir = "./"
; extension_dir = "ext"
; Be sure to appropriately set the extension_dir directive.
;sqlite3.extension_dir =
启动memcache
[root@14LN memcache-2.2.6]# /usr/local/memcached/bin/memcached -d -u root -m 63 -p 11211 -c 10240
[root@14LN memcache-2.2.6]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done

安装memcached服务器和PHP中添加memcache拓展模块的更多相关文章

  1. windows下安装Memcached服务器,PHP的memcache扩展

    Memcahed 介绍:Memcahed是一个内存缓存服务器 (类似MySQL服务器) 作用:提高web的响应速度,例如缓存数据库查询结果 原理:把数据存到内存中 (提高速度的原因) 教程相关 系统: ...

  2. 源码安装Memcached服务器及其2种PHP客户端

    本文所用源码包皆为当时最新stable稳定版. 安装memcached服务器 先安装libevent, 最新版为2.0.21 tar -zxvf libevent-2.0.21-stable.tar. ...

  3. Android中添加自己的模块 【转】

    本文转载自:http://wallage.blog.163.com/blog/static/17389624201021791333695/ 转:http://blog.csdn.net/yili_x ...

  4. 在jekyll模板博客中添加网易云模块

    最近使用GitHub Pages + Jekyll 搭建了个人博客,作为一名重度音乐患者,博客里面可以不配图,但是不能不配音乐啊. 遂在博客里面引入了网易云模块,这里要感谢网易云的分享机制,对开发者非 ...

  5. idea中添加多级父子模块

    在 IntelliJ IDEA 中,没有类似于 Eclipse 工作空间(Workspace)的概念,而是提出了Project和Module这两个概念. 在 IntelliJ IDEA 中Projec ...

  6. VS2010安装项目的系统必备中添加.NET 2.0

    把DotNetFX.rar解压后的DotNetFX文件夹,放置于安装了 VS2010 的 C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrap ...

  7. ZYNQ原理图中添加RTL设计模块

    前言 已有的RTL模块怎么添加到原理图中? 流程 (1)添加文件到设计中. (2)右键文件添加到block design中. (3)连线即可. 以上.

  8. 如何在Pycharm中添加新的模块

    在使用Pycharm编写程序时,我们时常需要调用某些模块,但有些模块事先是没有的,我们需要把模块添加上去. 最近在学习爬虫,写了下面几行代码: 结果出现错误 错误ModuleNotFoundError ...

  9. 如何在html中添加引用公共模块文件

    1.首先需要修改apache的配置文件: 打开httpd.conf 搜索“AddType text/html .shtml” 搜索结果: AddType text/html .shtml .html ...

随机推荐

  1. MyEclipse------文件字符输入,输出流读写信息

    other.jsp <%@ page language="java" import="java.util.*" pageEncoding="UT ...

  2. 将Spark中CompactBuf转换为String

    val rdd = sc.textFile("hdfs://hbase11:9000/sparkTsData/ipsoftware/wincc").map{ line => ...

  3. 【wget】一条命令轻松备份博客(包括图片)

    h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h ...

  4. js中test()函数在正则中使用

    test() 方法用于检测一个字符串是否匹配某个模式. 返回一个 Boolean 值,它指出在被查找的字符串中是否匹配给出的正则表达式. regexp.test(str) 参数 regexp 必选项. ...

  5. Nginx使用的php-fpm的两种进程管理方式及优化(转)

    php-fpm目前主要又两个分支,分别对应于php-5.2.x的版本和php-5.3.x的版本.在5.2.x的版本中,php-fpm.conf使用的是xml格式,而在新的5.3.x版本中,则是和php ...

  6. .NET中的装饰器设计模式

  7. HTTP长连接短连接

    一.什么是长连接 HTTP1.1规定了默认保持长连接(HTTP persistent connection ,也有翻译为持久连接),数据传输完成了保持TCP连接不断开(不发RST包.不四次握手),等待 ...

  8. 数据库多张表导出到excel

    数据库多张表导出到excel public static void export() throws Exception{ //声明需要导出的数据库 String dbName = "hdcl ...

  9. python遍历数组的两种方法

    第一种,最常用的,通过for in遍历数组 1 2 3 4 5 6 7 8 colours = ["red","green","blue"] ...

  10. Sublime Text 2 入门及技巧

    看了 Nettuts+ 对 Sublime Text 2 的介绍, 立刻就兴奋了,诚如作者 Jeffrey Way 所说:“<永远的毁灭公爵>都发布了,TextMate 2 还没发”,你还 ...