Linux下给PHP安装amqp扩展

 百家乐-前端     |      2020-03-24 05:53

本文介绍了在Linux下给PHP安装amqp扩充的经过,有亟待的心上人能够眷注一下。

安装rabbitmq-c依赖包

yum install libtool autoconf

安装librabbitmq-c和rabbitmq-codegen

# 下载0-9-1版的rabbitmq-c
git clone git://github.com/alanxz/rabbitmq-c.git
cd rabbitmq-c
# Enable and update the codegen git submodule
git submodule init
git submodule update
# Configure, compile and install
autoreconf -i && ./configure && make && sudo make install

本子下载:https://github.com/alanxz/rabbitmq-c/releases/tag/v0.5.0

wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.5.0/rabbitmq-c-0.5.0.tar.gz
tar -zxvf v0.5.0
cd rabbitmq-c-0.5.0/
autoreconf -i
./configure --prefix=/usr/local/rabbitmq-c
make
make install

安装pecl扩展

#下载最新的amqp扩展
wget http://pecl.php.net/get/amqp-1.0.9.tgz
tar xvzf amqp-1.0.9.tgz
cd amqp-1.0.9 && phpize
./configure --with-amqp && make && sudo make install

记得在php.ini中加入amqp扩展:

extension=amqp.so

安装PHP扩展 amqp

wget http://pecl.php.net/get/amqp-1.6.1.tgz
tar zxvf 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
make
make install