先安装rabbitmq-c
cd /download
wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
tar -zxvf rabbitmq-c-0.8.0.tar.gz
cd rabbitmq-c-0.8.0
./configure --prefix=/usr/local/rabbitmq-c
make && make install
现在开始安装amqp扩展
#回到download目录
cd /download
wget https://pecl.php.net/get/amqp-1.9.3.tgz
tar -zxf amqp-1.9.3.tgz
cd amqp-1.9.3
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c
make && make install
最后在php.ini加上,重启php-fpm即可
extension=amqp.so