php安裝RabbitMq擴充套件
RabbitMQ PHP擴充套件安裝
# 安裝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
ps:最好先用 find / -name php.ini 搜尋一下檔案路徑(這裡的路徑只是舉個例子)
# 增加下面內容
; rabbitmq擴充套件支援
extension=amqp.so
# 重啟php-fpm和nginx
systemctl restart php-fpm.service
systemctl restart nginx.service