Home >Backend Development >PHP Tutorial >When PHP installs the amqp extension, an error occurs that librabbitmq is not installed.

When PHP installs the amqp extension, an error occurs that librabbitmq is not installed.

炎欲天舞
炎欲天舞Original
2017-08-04 16:08:297821browse

Because you want to use the message queue, you need to install the ampq extension locally. As a result, during the installation process, the following error is reported:


configure: error: Please reinstall the librabbitmq distribution itself or (re)install librabbitmq development package if it available in your system

I searched all over the Internet and found the following article that perfectly solved my problem. I am reprinting it here for future reference.

The reason for this error is because the amqp dependency package rabbitmq-c is not installed, and rabbitmq-c needs to be installed first.

1. Install rabbitmq-c-0.7.1

If not installed, the above error will be prompted
I chose the latest version 0.7.1


wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.7.1/rabbitmq-c-0.7.1.tar.gz
tar zxf 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 success, you will see the following interface

2. Install amqp

I chose 1.6 .1


wget https://pecl.php.net/get/amqp-1.6.1.tgz
tar zxf amqp-1.6.1.tgz
cd amqp-1.6.1
 
/usr/local/php/bin/phpize
 
./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.7.1

Note: /usr/local/rabbitmq-c-0.7.1 here is required The same address as the rabbitmq-c installation above


make && make install

After the installation is successful, record the following address, configure and add php Useful when using modules

3. Add php module


vi /usr/local/php/etc/php.ini

Finally add a line


extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/amqp.so

Restart php


service php-fpm restart

4. Check amqp installation

Use phpinfo to check whether amqp is installed successfully

The above is the detailed content of When PHP installs the amqp extension, an error occurs that librabbitmq is not installed.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn