PHP binding

Source Code

http://github.com/mkoppanen/php-zmq

Build and installation

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

http://www.zeromq.org/intro:get-the-software

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:

extension=zmq.so

Building from Github

git clone git://github.com/mkoppanen/php-zmq.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:

extension=zmq.so

OR:
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:

extension=zmq.so

Restart PHP-FPM with

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

Windows

Download the latest snapshot from http://snapshot.zero.mq/

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:

extension=php_zmq.dll

Restart your web server to pickup the ini changes

FreeBSD

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.

Documentation

PHPdoc documentation: http://php.net/zmq
General documentation: http://wiki.github.com/mkoppanen/php-zmq/

Test Suite

The test suite can be run using:

$ make test

Bug Reporting

If you encounter problems please fill a bug report at:

http://github.com/mkoppanen/php-zmq/issues

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.