问题
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).
I've followed along the following tutorial: How to install ZeroMQ.
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);"
When using php 5.6, this error does not appear. How to fix this?
Edit
I 've found that ZeroMQ is currently "not working" with php7 from this post: ZeroMQ installation. Is there any workaround?
回答1:
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
For MacOS, you can replace apt-get
with brew
and it should also work.
Updated August 17, 2017
In newer versions of Ubuntu/Debian you can now do
sudo apt-get install php-zmq
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.
回答2:
I just published all the steps to install zmq and php-zmq on Debian or Ubuntu 16.04 with php7: Install ZMQ and php-zmq extension on Debian or Ubuntu
回答3:
I founded some version fully functional on php 7.0/7.1/7.2 (not yet functional on php 7.3)
First, install the compiler package :
apt-get -y install gcc make autoconf pkg-config
After that, depends on your ubuntu version.
12.04/14.04/16.04 :
apt-get -y install libzmq-dev
18.04 or more recent :
apt-get -y install libzmq3-dev
X.Y dépends on your php version (7.0/7.1/7.2)
peclX.Y-sp install zmq-beta
When prompted with message :
Please provide prefix of libzmq install just press ENTER
After that :
bash -c "echo extension=zmq.so > /etc/phpX.Y-sp/conf.d/zmq.ini"
service phpX.Y-fpm-sp restart
That will should work.
Can verify the ZMQLIB version :
phpX.Y-sp -i | grep zmq
回答4:
There is now a new release with PHP 7: https://pecl.php.net/package/zmq/1.1.3
来源:https://stackoverflow.com/questions/34476836/zeromq-with-php-7-in-ubuntu-does-not-compile-error-too-many-arguments-to-func