docker run -d --hostname rabbitmq --name rabbit -p 15672:15672 -p 5672:5672 rabbitmq
2.安裝 rabbitmq-c,C 與 RabbitMQ 通訊須要依賴 rabbitmq-c 庫(librabbitmq),具體請看https://github.com/alanxz/rabbitmq-cphp
git clone git://github.com/alanxz/rabbitmq-c.git cd rabbitmq-c cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq cmake --build . --target install
注意路徑指定,下載amqp擴展時須要指定路徑,同時須要修拷貝安裝路徑下的lib64爲lib,不然php擴展載入的時候找不到擴展git
3.接下來就是安裝 php amqp 的擴展了:github
你能夠源碼編譯安裝docker
wget http://pecl.php.net/get/amqp-1.8.0.tgz tar zxvf amqp-1.8.0.tgz cd amqp-1.8.0 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq make && make install
必須指定好 rabbitmq-c文件的安裝路徑才行bash
最後將‘extension=amqp.so’加入 php.iniui