To use the PHP development, to use the intermediate queue RABBITMQ, you must install the PHP extension Module AMQP, the server environment is php7.1.18, CentOS 6.8, Nginx 1.8
Using PHP's pecl command:/usr/local/php/bin/pecl install AMQP installation AMQP has reported the following error:
checking for AMQP using pkg-config ... CONFIGURE:ERROR:LIBRABBITMQ not found
error: '/tmp/pear/temp/amqp/configure--with-librabbitmq-dir ' failed
The wrong reason for reading the newspaper is that the LIBRABBITMQ library file is missing and the entire resolution is as follows:
The first step is to install LIBRABBITMQ
There are two ways to install LIBRABBITMQ, as follows:
The first method: directly using Yum to install LIBRABBITMQ, this method may not work, is your yum environment configuration problem, search is not LIBRABBITMQ, can not install, that will go to the following second method.
Second method: Install rabbitmq-c-0.7.1
Download Address: wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.7.1/rabbitmq-c-0.7.1.tar.gz
TAR-XZVF rabbitmq-c-0.7.1.tar.gz
cd rabbitmq-c-0.7.1
./configure--prefix=/usr/local/rabbitmq-c-0.7.1
Make&&make Install
After the installation is complete, you can continue to install AMQP
Second Step installation AMQP
Run command:/usr/local/php/bin/pecl install AMQP Run this command will appear as follows.
Set the path to librabbitmq install prefix [AutoDetect]:
If you are using the first method yum directly installed LIBRABBITMQ, you can directly press ENTER, if the second method, you need to install rabbitmq-c-0.7.1 directory input into the/usr/local/rabbitmq-c-0.7.1 and then press ENTER.
The third step is to add the extension module
After the AMQP installation is complete, you will be prompted to add the amqp.so extension module to the PHP configuration file.
Restart PHP-FPM
part Fourth Check AMQP module installation
Use the command phpinfo to view, appear as follows, indicating the installation was successful
AMQP protocol version 0-9-1
LIBRABBITMQ version 0.5.2