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.

  • 相关阅读:
    【JZOJ5771】遨游【二分】【DFS】
    【JZOJ5773】简单数学题【数论,数学】
    【JZOJ5773】简单数学题【数论,数学】
    有效壳第2部分:成为一个剪贴板体操运动员
    具有多重选择和列表间拖拽的拖拽列表框
    将枚举绑定到下拉列表框并根据值对其排序
    一个具有子项格式的自定义绘制列表控件
    基本的c#屏幕截图应用程序
    将组合框下拉列表宽度调整为最长字符串宽度
    在应用程序中使用按钮控件
  • 原文地址:https://www.cnblogs.com/codeAB/p/5591118.html
Copyright © 2011-2022 走看看