代码之家  ›  专栏  ›  技术社区  ›  Seva Kalashnikov

从自制的PHP@7.0安装PHP扩展mosquito

  •  0
  • Seva Kalashnikov  · 技术社区  · 6 年前

    操作系统:MacOS High Sierra 10.13.5

    我的php通过自制链接:

    which php
    /usr/local/bin/php
    
    php -v
    PHP 7.0.31 (cli) (built: Jul 19 2018 23:41:03) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
        with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
        with Zend OPcache v7.0.31, Copyright (c) 1999-2017, by Zend Technologies
    

    我有一个基于php的项目,我试图通过 composer install ,我得到:

     Your requirements could not be resolved to an installable set of packages.
    
     Problem 1
        - Installation request for pds/solace v1.0.1 -> satisfiable by pds/solace[v1.0.1].
        - pds/solace v1.0.1 requires ext-mosquitto * -> the requested PHP extension mosquitto is missing from your system.
    
      To enable extensions, verify that they are enabled in your .ini files:
        - /usr/local/etc/php/7.0/php.ini
        - /usr/local/etc/php/7.0/conf.d/ext-opcache.ini
      You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
    

    所以我试图通过Pecl安装扩展

    pecl install Mosquitto-alpha
    

    我得到了

    downloading Mosquitto-0.4.0.tgz ...
    Starting to download Mosquitto-0.4.0.tgz (23,804 bytes)
    ........done: 23,804 bytes
    5 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:         20151012
    Zend Module Api No:      20151012
    Zend Extension Api No:   320151012
    Please provide the prefix of the libmosquitto installation [autodetect] : 
    building in /private/tmp/pear/temp/pear-build-skalashnikovtgyrLB/Mosquitto-0.4.0
    running: /private/tmp/pear/temp/Mosquitto/configure --with-php-config=/usr/local/opt/php@7.0/bin/php-config --with-mosquitto
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for cc... cc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether cc accepts -g... yes
    checking for cc option to accept ISO C89... none needed
    checking how to run the C preprocessor... cc -E
    checking for icc... no
    checking for suncc... no
    checking whether cc understands -c and -o together... yes
    checking for system library directory... lib
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking build system type... x86_64-apple-darwin17.6.0
    checking host system type... x86_64-apple-darwin17.6.0
    checking target system type... x86_64-apple-darwin17.6.0
    checking for PHP prefix... /usr/local/Cellar/php@7.0/7.0.31
    checking for PHP includes... -I/usr/local/Cellar/php@7.0/7.0.31/include/php -I/usr/local/Cellar/php@7.0/7.0.31/include/php/main -I/usr/local/Cellar/php@7.0/7.0.31/include/php/TSRM -I/usr/local/Cellar/php@7.0/7.0.31/include/php/Zend -I/usr/local/Cellar/php@7.0/7.0.31/include/php/ext -I/usr/local/Cellar/php@7.0/7.0.31/include/php/ext/date/lib
    checking for PHP extension directory... /usr/local/Cellar/php@7.0/7.0.31/pecl/20151012
    checking for PHP installed headers prefix... /usr/local/Cellar/php@7.0/7.0.31/include/php
    checking if debug is enabled... no
    checking if zts is enabled... no
    checking for re2c... no
    configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
    checking for gawk... no
    checking for nawk... no
    checking for awk... awk
    checking if awk is broken... no
    checking for mosquitto support... yes, shared
    checking for mosquitto files in default path... not found
    configure: error: Please reinstall the mosquitto distribution
    ERROR: `/private/tmp/pear/temp/Mosquitto/configure --with-php-config=/usr/local/opt/php@7.0/bin/php-config --with-mosquitto' failed
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Seva Kalashnikov    6 年前

    我找到了解决办法。。必须执行:

    brew install mosquitto
    

    安装了 mosquitto 以及所有的依赖关系

    ==>安装mosquito的依赖项:c-ares、openssl、libev、libuv、libevent、libwebsockets

    ...

    ==>安装Mosquito

    ==>摘要 /usr/local/celler/mosquitto/1.4.14_2:33个文件,629.9KB

    然后执行

    pecl install Mosquitto-alpha
    

    它成功地安装并链接了php库

    正在下载mosquito-0.4.0.tgz。。。开始下载 mosquito-0.4.0.tgz(23804字节)……完成:23804字节

    ...

    生成过程已成功完成

    安装 '/usr/local/cell/php@7.0/7.0.31/pecl/20151012/mosquito.so'

    安装 好的:channel://pecl.php.net/Mosquitto-0.4.0

    扩展mosquito已启用 在php.ini中