Ubuntu中具有PHP 7的ZeroMQ无法编译(“错误:函数的参数过多”) [英] ZeroMQ with PHP 7 in Ubuntu does not compile ("error: too many arguments to function")

查看:56
本文介绍了Ubuntu中具有PHP 7的ZeroMQ无法编译(“错误:函数的参数过多”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have upgraded php5.6 to php7, but zeromq extension makes a lot of problems. Where can I download the correct zmq.so file for php7? None of the official sites offer a version for php7 that works (I'm using apache2.4).

我遵循以下教程:如何安装ZeroMQ

安装ZeroMQ步骤运行正常,但是当我执行命令 make时出现第二个错误,则第二步安装PHP绑定失败:

The step "Installing ZeroMQ" is working fine, but the second step "Installing the PHP binding" is failing when I execute the command "make" with the following error:

"/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时,不会出现此错误。如何解决这个问题?

When using php 5.6, this error does not appear. How to fix this?

我发现ZeroMQ当前在php7中不起作用从这篇文章中: ZeroMQ安装 。有任何解决方法吗?

I 've found that ZeroMQ is currently "not working" with php7 from this post: ZeroMQ installation. Is there any workaround?

推荐答案

可以通过PECL安装一个Beta版本,而我一直在使用它而没有

There is a beta version available via PECL that you can install, I have been working with it without any issues.

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

如果在安装过程中出现错误,则很可能会丢失某些依赖项

If you get an error during install then you are most likely missing some dependencies

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

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

For MacOS, you can replace apt-get with brew and it should also work.

在较新版本的Ubuntu / Debian现在可以执行

In newer versions of Ubuntu/Debian you can now do

sudo apt-get install php-zmq

推荐使用哪种方法,因为它使用了基础ZeroMQ库的较新版本,并会为您启用扩展。

Which is recommended over the previous method because it uses a newer version of the underlying ZeroMQ library and takes care of enabling the extension for you.

这篇关于Ubuntu中具有PHP 7的ZeroMQ无法编译(“错误:函数的参数过多”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆