mac安裝php-mq擴展

系統版本macos
php版本[email protected]_1

一  使用brew安裝 rabbitmq
brew install rabbitmq
brew services start rabbitmq 啓動

二 安裝rabbitmq-c
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.gz
#有修改下用戶
sudo chown -R xxxx:admin rabbitmq-c-0.7.1
cd rabbitmq-c-0.7.1
./configure --prefix=/usr/local/rabbitmq-c-0.7.1
make && make install

三安裝amqp
wget http://pecl.php.net/get/amqp-1.9.1.tgz
#有修改下用戶
sudo chown -R xxxx:admin amqp-1.9.1
cd amqp-1.9.1
/usr/local/Cellar/[email protected]/7.2.31_1/bin/phpize #對應php路徑
./configure --with-php-config=/usr/local/Cellar/[email protected]/7.2.31_1/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.7.1 #rabbitmq-c-0.7.1與rabbitmq-c安裝路徑一致
make && make install

四 添加擴展到php.ini
sudo vim /usr/local/Cellar/[email protected]/7.2.31_1/.bottle/etc/php/7.2/php.ini
extension=/usr/local/Cellar/[email protected]/7.2.31_1/pecl/20170718/amqp.so #對應好路徑
重啓服務
sudo brew services restart [email protected]

遇到的問題
make時
1.  amqp.c:27:10: fatal error: 'php.h' file not found
由於mac有自帶的php  我用不是自帶的,檢查了phpize 和 php-config是我安裝php的路,非此問題。
再次檢查安裝步驟時,開始我使用brew 安裝rabbitmq-c,在amqp ./configure 最後提示了error,於是brew uninstall rabbitmq-c。並且按上面步驟二重新安裝了rabbitmq-c。而後安裝amqp時 ./configure無誤。

2.fatal error: 'amqp_ssl_socket.h' file not found
爲找到amqp_ssl_socket.h文件,去rabbitmq-c下拷貝份到amqp-1.9.1下就可以了
sudo cp -r /usr/local/rabbitmq-c-0.7.1/librabbitmq/amqp_ssl_socket.h /usr/local/amqp-1.9.1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章