zoukankan      html  css  js  c++  java
  • php use memcached in ubuntu 14.04

    I assume you already had a lamp environment

    first step,we must to install memched in our Ubuntu System,
    open the url( https://memcached.org/downloads ) go to the Installation section ,you will see like this :

    Debian/Ubuntu: apt-get install libevent-dev Redhat/Centos: yum install libevent-devel

    wget http://www.memcached.org/files/memcached-1.4.25.tar.gz
    tar -zxvf memcached-1.4.25.tar.gz
    cd memcached-1.4.25
    ./configure && make && sudo make install

    just follow it to do

    to here ,if no some error occured ,you system already installed memcached service ;

    run memcached as daemaon service:
    memcached -d -u root

    And then ,

    In most cases,your php don't open the memcached extension,so we need to solve it ,
    you can compile php with enable-memcache,i think its a bad way ,so,I will use phpize to do it ,if you want to learn more about phpize ,to my another blog ( http://www.cnblogs.com/codeAB/p/5560371.html )

    go to the Url( http://pecl.php.net ) and search "memcache" you will look two simlilar package:

    memcache     memcached extension
    memcached     PHP extension for interfacing with memcached via libmemcached library

    If you look the php document, you alse see two extension memcache and memcached ,the two extension is more simlilar to use , But memcached is update soon means it will provide more new feature , I suggest to the memcached ,

    download memcached from ( http://pecl.php.net/get/memcached-2.1.0.tgz ; tips:don't download latest version 2.2,it not success in my ubuntu 14, you should try it )

    1. tar -xzvf memcached-2.1.0.tgz
    2. cd memcached-2.1.0/
    3. phpize

    (     if occured: No command 'phpize' found, did you mean:
        Command 'phpize5' from package 'php5-dev' (main)
        Fixed: sudo apt-get install php5-dev
    )
    4.  ./configure --enable-memcached

    (    if occured: configure: error: memcached support requires libmemcached
        Fixed:
        wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz  ( tips:don't get lastest version of 1.0.18,it unusefull for me )
        ./configure && make && sudo make install
    )
    5. make
    6. sudo make install  
    7. sudo vim /etc/php5/apache2/php.ini
    add one line in the end:  extension=memcached.so

    Now,sudo service apache2 restart

    use phpinfo() to see whether the memcached extension is appear.

  • 相关阅读:
    1.时间复杂度与空间复杂度分析
    数据结构与算法之重头再来
    MySQL时间字段与业务代码取出的时间不一致问题
    [redtiger]在线靶场level3
    win10 卡顿 MsMpEng.exe进程
    react 笔记 局部打印 print
    react table td 自动换行
    kali apt-get update release文件过期
    ubuntu怎么切换到root用户,切换到root账号方法
    winscp连接kali 使用预置密码验证 拒绝访问
  • 原文地址:https://www.cnblogs.com/codeAB/p/5591118.html
Copyright © 2011-2022 走看看