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.

炎欲天舞
Release: 2023-03-14 15:52:02
Original
7801 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

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


make && make install
Copy after login

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
Copy after login

Finally add a line


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

Restart php


service php-fpm restart
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template