zoukankan      html  css  js  c++  java
  • Linux环境下安装PHP的memced扩展

    先下载libmemcached:

    wget  https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

    解包:tar -zxf libmemcached-1.0.18.tar.gz 

    进入解压后的包,编译安装:

    ./configure --prefix=/usr/local/libmemcached --with-memcached        //注意:--with-memcached这个选项一定要加上

    make  &&  make install

    安装完成后,开始安装memcached模块:

    解包:tar zxvf memcached-2.2.0b1.tgz

    进入解压后的包:cd memcached-2.2.0b1

    phpize (或者/usr/local/php/bin/phpize)

    ./configure --with-php-config=/usr/local/php/bin/php-config  --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl

    发现报错:

    error: no, sasl.h is not available. Run configure with --disable-memcached-sasl to disable this check

    解决方法:

    当前目录下找到memcached.h

    find / -name memcached.h

    出现如下信息:

    /home/local/libmemcached-1.0.18/libtest/memcached.h
    /home/local/libmemcached-1.0.18/libmemcached-1.0/struct/memcached.h
    /home/local/libmemcached-1.0.18/libmemcached-1.0/memcached.h
    /home/local/libmemcached-1.0.18/libmemcached/memcached.h
    /usr/local/libmemcached/include/libmemcached-1.0/memcached.h
    /usr/local/libmemcached/include/libmemcached-1.0/struct/memcached.h
    /usr/local/libmemcached/include/libmemcached/memcached.h

    修改php_libmemcached_compat.h:

    vim php_libmemcached_compat.h

    找到include

    改成

    #ifndef PHP_LIBMEMCACHED_COMPAT
    #define PHP_LIBMEMCACHED_COMPAT

    /* this is the version(s) we support */
    #include </usr/local/libmemcached/include/libmemcached/memcached.h>

    将<>里面的内容替换成:/usr/local/libmemcached/include/libmemcached/memcached.h

    然后

    ./configure --with-php-config=/usr/local/php/bin/php-config  --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl

    make && make install

    cp /usr/local/php/lib/php/extensions/no-debug-zts-20131226/memcached.so /usr/local/php/extension/memcached.so

    vim /usr/local/php/etc/php.ini 添加: extension=memcached.so

     /usr/local/apache/bin/apachectl restart

    php -m

    出现了memcached即安装成功

  • 相关阅读:
    利用ssh传输文件
    linux 终端常用快捷键
    ubuntu 下关闭apache服务自动启动
    linux ps命令介绍
    virtualenv 使用
    startuml 2.6注册
    三代组装小基因组研究综述
    畅想未来的测序
    测序简史
    纳米孔测序技术介绍
  • 原文地址:https://www.cnblogs.com/ttiandeng/p/6560992.html
Copyright © 2011-2022 走看看