zoukankan      html  css  js  c++  java
  • 安装memcached服务器和PHP中添加memcache拓展模块

    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
    

     

  • 相关阅读:
    Oracle基础 (十二)数学函数
    Oracle基础 (十一)字符串函数
    Oracle基础(十) DML数据操作
    Oracle 常用命令大全
    Oracle 常用的SQL语法和数据对象
    Server.MapPath()
    登陆sharepoint的主页,提示:文件存在(异常来自 HRESULT:0x80070050)
    如何查看电脑的开机时间
    SQL 2008登录的域账户与数据库服务器不再同一个域的 处理方法
    发布MVC项目到服务器上时候遇到的 模块 DirectoryListingModule 通知 ExecuteRequestHandler 处理程序 StaticFile 错误代码 0x00000000
  • 原文地址:https://www.cnblogs.com/bass6/p/5615195.html
Copyright © 2011-2022 走看看