PHP binding

Source Code

Build and installation

You will first need to install the ØMQ (2.1.x or higher recommended)

Then obtain the php bindings for 0MQ - these work with PHP 5.2.x and above.

Building via PEAR

The extension can be built via PECL.

sudo pecl install zmq-beta

You may have to add the extension to your php.ini with this line:

Building from Github

git clone git://

and cd to the directory:

$ cd php-zmq

Next, run phpize to generate configure script and run the configure command:

phpize && ./configure

Tip: If you are using php installed from your distribution's package manager the 'phpize' command is usually in php-dev or php-devel package

Finally install the package by running:

$ make && make install

You may have to run this last commands with sudo.

Finally add the following line to your php.ini:

If you are using PHP 5.4.x and/or using PHP-FPM, you will need to add a zmq.ini file in /etc/php5/conf.d:
Add the following:

Restart PHP-FPM with

sudo /etc/init.d/php5-fpm restart


Download the latest snapshot from

Copy libzmq.dll into your php directory (e.g. C:\wamp\bin\php\php5.3.8\)

Copy the appropriate version of php_zmq.dll to your php extension directory (e.g. C:\wamp\bin\php\php5.3.8\ext)

Add the following line to your php.ini:


Restart your web server to pickup the ini changes


In FreeBSD PHP must be configured with "Link thread lib (for threaded extensions)" option. Without this option the PHP binding will hang when creating new contexts or sockets.


PHPdoc documentation:
General documentation:

Test Suite

The test suite can be run using:

$ make test

Bug Reporting

If you encounter problems please fill a bug report at:

or write an e-mail to:

mkoppanen (at) php dot net

Mailing List

Discussions about this language binding take place on the general zeromq-dev list.