PHP-ZMQ pecl 安装错误 - 无法找到 libzmq 安装

PHP-ZMQ pecl 安装错误 - 无法找到 libzmq 安装

我根据 ZeroMQ 网站运行了以下 shell 命令来安装 PHP-ZMQ:

sudo pear channel-discover pear.zero.mq
sudo pecl install pear.zero.mq/zmq-beta

以下是安装的轨迹:

downloading zmq-1.0.6.tgz ...
Starting to download zmq-1.0.6.tgz (23,880 bytes)
........done: 23,880 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
building in /var/tmp/pear-build-rootwCcLwT/zmq-1.0.6
running: /var/tmp/zmq/configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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 ANSI C... 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-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking target system type... x86_64-redhat-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/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... gawk
checking whether to enable 0MQ support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking libzmq installation... configure: error: Unable to find libzmq installation
ERROR: `/var/tmp/zmq/configure' failed

我已经在我的服务器上libzmq安装了。YumCentOS 5

我也可以通过运行以下命令进行确认

yum install zeromq

以及下面的痕迹:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.site.net.au
 * extras: mirror.site.net.au
 * updates: mirror.site.net.au
Setting up Install Process
Package zeromq-3.2.2-13.1.x86_64 already installed and latest version
Package zeromq-3.2.2-13.1.i386 already installed and latest version
Nothing to do

所以我已经libzmq安装了,所以我不明白为什么PHP-ZMQ在安装时会出现错误。

造成这种情况的原因是什么?

答案1

您需要开发文件。我敢打赌,在基于 RPM 的发行版中,它们被称为 zeromq-devel 或类似的名称。

答案2

通过 brew 安装 CZMQ 为我解决了这个问题。

答案3

对于任何未来遇到此问题的人 - 我确实按照此指示尝试过零MQ-sudo pecl install zmq-beta在我的 Mac 上。然后我按照 @Tinus Guichelaar 的指示尝试 - brew install czmq。经过多次失败的解决方案后,它终于成功了!

答案4

遇到了类似的问题,在 Centos 7 上使用 PHP 7.1.3 安装 ZMQ 通过 PECL 安装失败,从源代码构建,同样的问题。

这为我解决了这个问题:

yum search zmq

您将获得所有可用软件包的列表,选择适合您特定设置的软件包(在我的情况下这是结果:)

=========================================================== N/S matched:    zmq ============================================================
cppzmq-devel.x86_64 : Development files for cppzmq
czmq-devel.x86_64 : Development files for the czmq package
perl-ZMQ-Constants.noarch : Constants for the libzmq library
perl-ZMQ-LibZMQ3.x86_64 : Perl wrapper for the libzmq 3.x library
python-zmq-debuginfo.x86_64 : Debug information for package python-zmq
czmq.x86_64 : High-level C binding for 0MQ (ZeroMQ)
php-pecl-zmq.x86_64 : ZeroMQ messaging
php54-php-pecl-zmq.x86_64 : ZeroMQ messaging
php55-php-pecl-zmq.x86_64 : ZeroMQ messaging
php56-php-pecl-zmq.x86_64 : ZeroMQ messaging
php70-php-pecl-zmq.x86_64 : ZeroMQ messaging
php71-php-pecl-zmq.x86_64 : ZeroMQ messaging
php72-php-pecl-zmq.x86_64 : ZeroMQ messaging
php73-php-pecl-zmq.x86_64 : ZeroMQ messaging
php74-php-pecl-zmq.x86_64 : ZeroMQ messaging
php80-php-pecl-zmq.x86_64 : ZeroMQ messaging
php81-php-pecl-zmq.x86_64 : ZeroMQ messaging
python-txzmq.noarch : Twisted bindings for ZeroMQ
python-zmq.x86_64 : Software library for fast, message-based applications
python-zmq-tests.x86_64 : Software library for fast, message-based applications
python2-zmq.x86_64 : Software library for fast, message-based applications
python2-zmq-tests.x86_64 : Software library for fast, message-based applications
python36-zmq.x86_64 : Software library for fast, message-based applications
python36-zmq-tests.x86_64 : Software library for fast, message-based applications

Name and summary matches only, use "search all" for everything.

我选择了 PHP71 版本,因为它符合我的需求(您的情况可能会有所不同)

yum install php71-php-pecl-zmq.x86_64 -y

完毕!

相关内容