gpt4 book ai didi

php - Ubuntu 中带有 PHP 7 的 ZeroMQ 无法编译 ("error: too many arguments to function")

转载 作者:行者123 更新时间:2023-12-04 16:02:16 29 4
gpt4 key购买 nike

我已经将 php5.6 升级到 php7,但是 zeromq 扩展产生了很多问题。我在哪里可以为 php7 下载正确的 zmq.so 文件?没有一个官方网站提供适用于 php7 的版本(我使用的是 apache2.4)。

我遵循了以下教程:How to install ZeroMQ .

“安装 ZeroMQ”这一步工作正常,但是当我执行命令“make”时第二步“安装 PHP 绑定(bind)”失败并出现以下错误:

"/home/puser/zeromq-4.1.4/php-zmq/zmq.c:2740:2: error: too many arguments to 
function 'zend_register_internal_class_ex' php_zmq_device_exception_sc_entry =
zend_register_internal_class_ex(&ce_device_exception, php_zmq_exception_sc_entry,
"ZMQException" TSRMLS_CC) ^ In file included from /usr/include/php/20151012/main/php.h:40:
0, from /home/puser/zeromq-4.1.4/php-zmq/php_zmq.h:45,from /home/puser/zeromq-4.1.4/php-zmq
/zmq.c:31:/usr/include/php/20151012/Zend/zend_API.h:290:28: note: declared here ZEND_API
zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry,
zend_class_entry *parent_ce);"

使用php 5.6时,不会出现这个错误。如何解决这个问题?

编辑

我从这篇文章中发现 ZeroMQ 当前“无法与 php7 一起工作”:ZeroMQ installation .有什么解决方法吗?

最佳答案

您可以通过 PECL 安装一个 beta 版本,我一直在使用它,没有任何问题。

sudo apt-get install php-pear
pecl install zmq-beta

如果您在安装过程中遇到错误,那么您很可能缺少一些依赖项

sudo apt-get install php7.0-dev libzmq-dev pkg-config

对于 MacOS,您可以将 apt-get 替换为 brew,它应该也可以工作。


2017 年 8 月 17 日更新

在较新版本的 Ubuntu/Debian 中,您现在可以这样做

sudo apt-get install php-zmq

推荐使用之前的方法,因为它使用更新版本的底层 ZeroMQ 库并负责为您启用扩展。

关于php - Ubuntu 中带有 PHP 7 的 ZeroMQ 无法编译 ("error: too many arguments to function"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34476836/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com