linux 编译安装amqp扩展
php -m |grep amqp
一、安装rabbitmq-c-0.8.0
当前目录为 /usr/local/src/
[root@localhost src]# wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
[root@localhost src]# tar zxf rabbitmq-c-0.8.0.tar.gz
[root@localhost src]# cd rabbitmq-c-0.8.0
[root@localhost rabbitmq-c-0.8.0]# ./configure --prefix=/usr/local/src/rabbitmq-c-0.8.0
[root@localhost rabbitmq-c-0.8.0]# make && make install
二、安装amqp
[root@localhost src]# wget http://pecl.php.net/get/amqp-1.9.4.tgz
[root@localhost src]# tar zxf amqp-1.9.4.tgz
[root@localhost src]# cd amqp-1.9.4
[root@localhost amqp-1.9.4]# /www/server/php/72/bin/phpize
[root@localhost amqp-1.9.4]# ./configure --with-php-config=/www/server/php/72/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/src/rabbitmq-c-0.8.0
[root@localhost amqp-1.9.4]# make && make install
安装成功之后记录模块路径的地址
三、添加php模块
[root@localhost /]# vim /www/server/php/72/etc/php.ini
在文件末尾添加一行
extension = /www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/amqp.so
重启php
[root@localhost /]# service php-fpm restart
四、检测amqp是否安装成功
[root@localhost /]# php -m
如图说明安装成功