1.要安装AMQP PHP扩展,必须先安装librabbitmq库
1.1使用以下步骤下载并安装库:
# 下载
git clone git://github.com/alanxz/rabbitmq-c.git
或者:wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
cd rabbitmq-c
# 编译安装
autoreconf -i && ./configure && make && sudo make install
2.安装AMQP
wget https://pecl.php.net/get/amqp-1.9.1.tgz
cd amqp-1.9.1
#指定php-config路径,指定librabbitmq路径
/usr/local/php-7/bin/phpize
./configure --with-php-config=/usr/local/php-7.0.0/bin/php-config --with-librabbitmq-dir=/usr/local/
make -j all
make install