Home > Backend Development > PHP Tutorial > Detailed explanation of how to install php extension-amqp

Detailed explanation of how to install php extension-amqp

藏色散人
Release: 2023-04-09 22:48:02
forward
4416 people have browsed it

This article will introduce how to install the php extension-amqp. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Detailed explanation of how to install php extension-amqp

Recommended: "PHP Video Tutorial"

Install the php extension (the php7.2 version I use)

php uses amqp to call RabbitMQ, so download ampq first

$ wget https://pecl.php.net/get/amqp-1.9.3.tgz #下载
$ tar -xvf amqp-1.9.3.tgz #解压
$ cd amqp-1.9.3$ /usr/local/php/bin/phpize #用phpize生成编译文件,注意查看你的php在哪里
$ ./configure --with-php-config=/usr/local/php/bin/php-config
Copy after login

At this step, I reported an error: checking for amqp using pkg-config... configure: error: librabbitmq not found

This error prompts that you need to install one more: rabbitmq-c

Go here to download: https://github.com/alanxz/rabbitmq-c/releases

$ wget https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz
$ tar -xvf v0.9.0.tar.gz
$ cd rabbitmq-c-0.9.0/
Copy after login

Prepare to configure At that time, I found that there was no configure, and 0.9 was changed to cmake. Damn, install cmake

$ yum -y install cmake
$ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c-0.9.0 #指定安装目录
$ make
$ make install
Copy after login

and then go back and compile amqp-1.9.3

$ ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.9.0$ make
$ make install
Copy after login

make and report an error!

I found some clues. I entered the /usr/local/rabbitmq-c-0.9.0/lib directory. After checking, I found that /usr/local/rabbitmq-c-0.9.0/ does not have lib, but there is lib64 bit.

Process it:

$ cp -R /usr/local/rabbitmq-c-0.9.0/lib64/ /usr/local/rabbitmq-c-0.9.0/lib
Copy after login

Then do: make && make install, OK.

Detailed explanation of how to install php extension-amqp

Add to php.ini to check it out!

extension=amqp.so

Detailed explanation of how to install php extension-amqp

The extension is installed successfully. At this time, you can use PHP to operate RabbitMQ.

The above is the detailed content of Detailed explanation of how to install php extension-amqp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
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