← ServerPilot Docs

How to Install the PHP AMQP Extension

To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.
The PHP AMQP extension requires Ubuntu 16.04 or 18.04. This extension will not work on Ubuntu 14.04 as the extension requires a newer version of the librabbitmq library than Ubuntu supports on 14.04.

The PHP AMQP extension provides PHP functions for communicating with AMQP-compatible servers, such as RabbitMQ.

Installing the AMQP Extension on PHP 7.3 or 7.4

The AMQP extension does not yet support PHP 7.3 or 7.4.

Installing the AMQP Extension on PHP 5 through 7.2

In the examples shown, replace "X.Y" with your app's PHP version (for example, "7.0").

To install the PHP AMQP extension, SSH in to your server as root and first run the following commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libssl-dev
sudo apt-get -y install librabbitmq-dev

Next, run the following command:

sudo peclX.Y-sp install amqp

When you receive this prompt:

Set the path to librabbitmq install prefix [autodetect] :

press Enter without entering a prefix. This allows the library's location to be autodetected.

Once installed, create a configuration file for the extension and restart PHP by running the following command as root:

sudo bash -c "echo extension=amqp.so > /etc/phpX.Y-sp/conf.d/amqp.ini"
sudo service phpX.Y-fpm-sp restart

Verifying the PHP AMQP Extension Is Installed

You can verify the AMQP extension is installed by running this command:

phpX.Y-sp -i | grep -i amqp

You should see output similar to the following:

Additional .ini files parsed => /etc/php7.1-sp/conf.d/amqp.ini,
amqp
AMQP protocol version => 0-9-1
amqp.auto_ack => 0 => 0
amqp.channel_max => 256 => 256
amqp.connect_timeout => 0 => 0
amqp.frame_max => 131072 => 131072
amqp.heartbeat => 0 => 0
amqp.host => localhost => localhost
amqp.login => guest => guest
amqp.password => guest => guest
amqp.port => 5672 => 5672
amqp.prefetch_count => 3 => 3
amqp.read_timeout => 0 => 0
amqp.timeout => no value => no value
amqp.vhost => / => /
amqp.write_timeout => 0 => 0

Uninstalling the AMQP Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/amqp.ini
sudo peclX.Y-sp uninstall amqp

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes