zeromq/php-zmq

Module Api Conflicts on php 5.6 (Ampps) for PECL Package v 1.1.3

mooror opened this issue · 2 comments

Hello everyone, I'm trying to setup the php zmq package through pecl and am having some issues. I read through and followed these instructions for installing zeroMQ and the pecl package. Everything seemed to work fine when I installed it but when I went to actually use the module in my code I recieved these errors:

PHP Warning:  PHP Startup: zmq: Unable to initialize module
Module compiled with module API=20151012
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

Warning: PHP Startup: zmq: Unable to initialize module
Module compiled with module API=20151012
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0
PHP Fatal error:  Class 'ZMQContext' not found in /usr/local/ampps/www/zmq/rep.php on line 2
PHP Stack trace:
PHP   1. {main}() /usr/local/ampps/www/zmq/rep.php:0

Fatal error: Class 'ZMQContext' not found in /usr/local/ampps/www/zmq/rep.php on line 2

Call Stack:
    0.0002     229688   1. {main}() /usr/local/ampps/www/zmq/rep.php:0

Heres the code I'm trying to run:

<?php
$context = new ZMQContext();
$server =$context->getSocket(ZMQ::SOCKET_REP);
$server->bind("tcp://*:5454");
while(true) {
    $message = $server->recv();
    echo "Sending $message World", PHP_EOL;
    $server->send($message . " World");
}

I believe this is due to the module being built with a newer version of the Module Api (perhaps php 7's?). If this is indeed the case then I would ask if it could be recompiled using the 20131226 module api version as I believe the package says its compatible with 5.3 or newer.

Thanks in advance,
Mooror

Module compiled with module API=20151012
PHP compiled with module API=20131226

Trying to use with PHP 5.6 a module build with PHP 7.1

Thanks for the reply @remicollet. Unfortunately I wont be able to test the changes you suggested. Its been a couple of years since I last used ZMQ, and even if I was to use it now, all our workstations are updated to PHP 7.

I'll close this issue as even when it was open I (seemingly) was the only one experiencing the issue.