rabbitmq php 安裝amqp擴展

一:安裝rabbitmq-c-0.7.1php

沒有安裝就會提示上面的錯誤
下載地址:https://github.com/alanxz/rabbitmq-c
我選擇的是最新版本0.7.1html

wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.7.1/rabbitmq-c-0.7.1.tar.gz
tar zxf rabbitmq-c-0.7.1.tar.gzlinux

cd rabbitmq-c-0.7.1
./configure --prefix=/usr/local/rabbitmq-c-0.7.1
make && make install
備註:若是下面的下載比較慢,您能夠到百度雲盤下載我下載下來的文件,雲盤地址:http://pan.baidu.com/s/1kVwRD2Z#list/path=%2F,打開這個連接,找到文件rabbitmq-c-0.7.1.tar下載下來便可git

二:安裝amqpgithub

下載地址https://pecl.php.net/package/amqp
我選擇的是1.6.1centos

!!!對於php7.1,須要下載高版本:php7

wget https://pecl.php.net/get/amqp-1.9.3.tgz //php 7.1
wget https://pecl.php.net/get/amqp-1.6.1.tgz // php 5.6
tar zxf amqp-1.6.1.tgz
cd amqp-1.6.1ide

/usr/local/php/bin/phpize.net

./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.7.1
注意:這裏的/usr/local/rabbitmq-c-0.7.1要跟上面rabbitmq-c安裝的地址同樣htm

make && make install
而後打開/etc/php.ini

添加配置:

extension=amqp.so
重啓php,phpinfo就能夠看到配置了

到這裏就完成了,以前找了不少資料就會報錯,惟有這個方式沒有問題,個人linux是centos6,php版本5.4和7都安裝經過了。

參考資料:https://www.phpsong.com/2223.html

相關文章
相關標籤/搜索