• Linux基于libmemcached,php扩展memcached的安装


    我的系统环境是:centos6.5

    安装php memcached遇到的坑。

    参考博主【阳光温暖了心情】文章地址:http://www.cnblogs.com/yangxia-test/p/4195288.html

    文件:libmemcached-1.0.18.tar.gz
    1、libmemcached下载地址:https://launchpad.net/libmemcached/+download

    文件:memcached-2.2.0.tgz

    2、php-memcached下载地址:http://pecl.php.net/package/memcached


    在 php-memcached官网发现有最新的版本3.0.3 stable版本,安装几次没有成功,总提示:
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4361: error: too few arguments to function ‘zend_declare_class_constant_bool’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c: In function ‘zm_startup_memcached’:
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4371: error: ‘zend_object_handlers’ has no member named ‘offset’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4373: error: ‘zend_object_handlers’ has no member named ‘free_obj’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4378: error: too few arguments to function ‘zend_register_internal_class’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4378: warning: assignment from incompatible pointer type
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4379: warning: assignment from incompatible pointer type
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: error: too few arguments to function ‘zend_register_internal_class_ex’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: warning: assignment from incompatible pointer type
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4379: warning: assignment from incompatible pointer type

    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: error: too few arguments to function ‘zend_register_internal_class_ex’
    /bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: warning: assignment from incompatible pointer type
    make: *** [php_memcached.lo] Error 1……

    之后下载3.0.1编译还是一样不能通过,只好根据博主文章中提到的,下载了php-memcached 2.2.0,按照博主介绍的方法安装,一步到位安装成功。

    参考博主【阳光温暖了心情】文章地址:http://www.cnblogs.com/yangxia-test/p/4195288.html

    php的扩展memcache,不支持cas,所以我们要装memcached扩展,memcached扩展是基于libmemcached,所以要先安装libmemcached

    一、下载软件

    1、libmemcached下载地址:https://launchpad.net/libmemcached/+download

    文件:memcached-2.2.0.tgz

    2、php-memcached下载地址:http://pecl.php.net/package/memcached

    文件:libmemcached-1.0.18.tar.gz 

    二、安装libmemcached

    [root@vm15 local]# mkdir -p libmemcached
    [root@vm15 local]# tar zxvf libmemcached-1.0.18.tar.gz 
    [root@vm15 local]# cd libmemcached-1.0.18
    [root@vm15 libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached
    [root@vm15 libmemcached-1.0.18]# make
    [root@vm15 libmemcached-1.0.18]# make install

    三、安装php-memcached

    [root@vm15 local]# mkdir -p phpmemcached 
    [root@vm15 local]# tar zxvf memcached-2.2.0.tgz
    [root@vm15 local]# cd memcached-2.2.0
    [root@vm15 memcached-2.2.0]# /usr/local/php/bin/phpize
    Configuring for:
    PHP Api Version: 20131106
    Zend Module Api No: 20131226
    Zend Extension Api No: 220131226
    [root@vm15 memcached-2.2.0]# ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached 
    -sasl
    [root@vm15 memcached-2.2.0]# make
    [root@vm15 memcached-2.2.0]# make install
    Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
    [root@vm15 memcached-2.2.0]# ll /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

    total 2140
    -rwxr-xr-x. 1 root root 325608 Dec 30 15:59 memcached.so
    -rwxr-xr-x. 1 root root 453766 Dec 30 17:44 memcache.so
    -rwxr-xr-x. 1 root root 540834 Dec 19 15:38 opcache.so
    -rwxr-xr-x. 1 root root 861055 Dec 30 16:47 redis.so

    [root@vm15 memcached-2.2.0]# vi + /usr/local/php/lib/php.ini
    加上extension=memcached.so

    #重启Apache服务
    [root@vm15 memcached-2.2.0]# /usr/local/apache2/bin/apachectl restart
    查看phpinfo可以看到支持了

  • 相关阅读:
    Google Plus 是什么?Google+让Google在线资产在日常生活中更普及
    再谈JavaScript的数据类型问题
    [置顶]信息发布系统 Jquery+MVC架构开发(5)DAL层
    Android:一个简单查询界面的实现
    定制圆角带背景色的矩形边框
    提高c#位图操作的速度[抄袭之作]
    使用XmlTextWriter和XmlTextReader操作Xml文件
    使用Mutex实现单程序实例
    单例模式实现延迟加载
    A记录、MX记录、CNAME 记录、URL转发、NS记录解释
  • 原文地址:https://www.cnblogs.com/cyun/p/6738451.html
Copyright © 2020-2023  润新知