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即安装成功

  • 相关阅读:
    有继承的C++析构函数一定要用virtual
    CUDA vs2010配置
    lambda calculus(1)
    SICP练习1.6 1.16 解答
    用函数式来实现集合
    osx guile编译安装
    skiplist poj2892
    [转]理解 pkgconfig 工具
    专业术语解释
    【转】如何学习linux设备驱动
  • 原文地址:https://www.cnblogs.com/ttiandeng/p/6560992.html
Copyright © 2011-2022 走看看