从自制软件为php@7.0安装PHP扩展名mosquitto

时间:2018-08-06 18:22:35

标签: php macos homebrew pecl mosquitto

OS: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 个答案:

答案 0 :(得分:0)

我能够找到解决方案..必须执行:

brew install mosquitto

已安装mosquitto和所有依赖项

  

==>为mosquitto安装依赖项:c-ares,openssl,libev,libuv,libevent,libwebsockets

     

...

     

==>安装mosquitto

     

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

然后执行

pecl install Mosquitto-alpha

成功安装了php lib并将其链接

  

正在下载Mosquitto-0.4.0.tgz ...开始下载   Mosquitto-0.4.0.tgz(23,804字节)........完成:23,804字节

     

...

     

构建过程成功完成

     

安装   '/usr/local/Cellar/php@7.0/7.0.31/pecl/20151012/mosquitto.so'

     

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

     

启用了扩展蚊子   在php.ini中