see also http://www.zeromq.org/bindings:php
wget http://www.zeromq.org/local--files/area:download/zeromq-2.0.9.tar.gz
tar zxf zeromq-2.0.9.tar.gz
cd zeromq-2.0.9
./configure
make && make install
cd ..
git clone git://github.com/mkoppanen/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install
echo 'extension=zmq.so' > /etc/php.d/zeromq.ini
<?php
$server = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_PUB);
$server->bind("tcp://127.0.0.1:5555");
for(;;){
echo "say Hello to subscriber." . PHP_EOL;
$server->send("test Hello");
sleep(1);
}
?>
<?php
$queue = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_SUB);
$queue->connect("tcp://127.0.0.1:5555");
// testに前方一致したメッセージを拾うよ
$queue->setsockopt(ZMQ::SOCKOPT_SUBSCRIBE,"test");
var_dump($queue->recv());
?>