RabbitMQ添加php扩展

RabbitMQ添加php扩展

1,主要需要两个包:

rabbitmq-c的包

amqp的包

2,下载对应的包:

wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.4.1/rabbitmq-c-0.4.1.tar.gz 

tar zxvf rabbitmq-c-0.4.1.tar.gz

wget http://pecl.php.net/get/amqp-1.2.0.tgz

tar zxvf amqp-1.2.0.tgz

cd rabbitmq-c-0.4.1

./configure --prefix=/usr/local/rabbitmq-c-0.4.1

make && make install
cd amqp-1.2.0
phpize
如果没有phpize,安装:yum install php-devel

(如果编译安装时候报错:amqp  make: *** No targets specified and no makefile found.  Stop. 那么就执行install php-devel命令)
./configure --with-php-config=/usr/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.4.1/
make && make install
vi /etc/php.ini
[rabbitmq]
       extension=amqp.so
service httpd restart
开启rabbitmq
       service rabbitmq-server start

你可能感兴趣的:(RabbitMQ)