编译安装rabbitmq及PHP扩展amqp

                    编译安装rabbitmq及PHP扩展amqp

# 安装rabbitmq-c依赖包
yum install libtool autoconf

# 安装rabbitmq-c ( 最好下载 0.5的,0.6安装可能会报错)
# 版本下载: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

# 安装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

# 编辑php.ini文件,增加amqp扩展支持
vim /usr/local/php/etc/php.ini

# 增加下面内容
; rabbitmq扩展支持
extension=amqp.so

# 重启php-fpm
/etc/init.d/php-fpm restart

猜你喜欢

转载自blog.csdn.net/Ghost_hell/article/details/73649987