Tag Archives: amqp

Installing and using the AMQP PECL extension

After spending two fairly painful days refactoring some code away from PHPAMQPLib (some custom PHP classes that allow for a connection with RabbitMQ) and moving to the official PECL extension I thought I’d document. Let me know if this has helped you!

First of all you need to get a compatible version of the rabbitMQ C library, as the version shipped with Ubuntu 11.10 and 12.04 are not compatible with the PECL extension.

sudo su
 
apt-get install mercurial
hg clone http://hg.rabbitmq.com/rabbitmq-c
cd rabbitmq-c
hg clone http://hg.rabbitmq.com/rabbitmq-codegen codegen
 
autoreconf -i 
./configure
make
make install

and then it should just be a case of installing the PECL extension as-per-the-usual-way:

pecl install amqp

I’m hoping to follow this up with some AMQP examples, as the manual is pretty much “function declaration only” at this point and there are very few examples out there. Stay tuned.