Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jimmck's avatar
Level 13

ZeroMQ PHP Bindings

Hi, Has anyone built the ZeroMQ PHP bindings. I had to edit the include path for the PHP C headers and the Zend headers.

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 -I/usr/local/Cellar/zeromq/4.0.5_2/includeL

/usr/include/php is the basr path.

This is MAC Yosemitie, using XAMPP install.

I can do a build, and get a zmq.so filr, but composer gives an error during update:

Problem 1 - react/zmq v0.3.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system. - react/zmq v0.2.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system. - Installation request for react/zmq 0.2.|0.3. -> satisfiable by react/zmq[v0.2.0, v0.3.0].

php -m | grep zmq also shows a problem with the libs.

Library not loaded: /usr/local/lib/libzmq.4.dylib Referenced from: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/zmq.so Reason: no suitable image found. Did find: /usr/local/lib/libzmq.4.dylib: not a dylib /usr/local/lib/libzmq.4.dylib: not a dylib in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/zmq.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/zmq.so, 9): Library not loaded: /usr/local/lib/libzmq.4.dylib Referenced from: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/zmq.so /usr/local/lib/libzmq.4.dylib: not a dylib /usr/local/lib/libzmq.4.dylib: not a dylib in Unknown on line 0 Jamess-MacBook-Pro:php jimm$

Built from POSIX source tar bundle.

http://zeromq.org/bindings:php

Is there a MAC specific source?

Jim

0 likes
1 reply
jimmck's avatar
jimmck
OP
Best Answer
Level 13

Hi, I got it solved. In my /usr/local/lib is a lib called libzmq.4.dylib. I looked at other libs in the dir and they all sym link to ../Celler direectory. Went to dir and there is a zeromq dir (this got built either when installed packageinfo or the lib build, still checking timestamps). In the version directory there is a lib dir, so I sym linked to that dir and yes php -m | zmq worked and composer update installed the zero mq packages.

lrwxr-xr-x 1 jimm admin 51 Nov 3 18:41 libzmq.4.dylib -> /usr/local/Cellar/zeromq/4.0.5_2/lib/libzmq.4.dylib

"require": { "laravel/framework": "4.2.", "laracasts/commander": "~1.0", "indatus/dispatcher": "~1.4", "cboden/ratchet": "0.3.", "react/zmq": "0.2.|0.3." <---- Installed.

I already have the rachet demo working in Laravel42, now I am going to setup pubsub example with ratchet and zeromq. ultimate interest is to connect my JMS pub/sub into react and have laravel apps have access to the data resources.

Jim

Please or to participate in this conversation.