PHP amqp扩展安装

1.安装 rabbitmq-c

下载地址:https://github.com/alanxz/rabbitmq-c

> mkdir build

> cd build

> cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DCMAKE_INSTALL_PREFIX=/usr/local ..

> cmake --build . --target install

出现的问题:

CMake Error at /usr/local/Cellar/cmake/3.11.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the

system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR) (Required

解决方案:

brew install OpenSSL

-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib

2.安装PHP扩展

pecl.php.net上下载

> /usr/local/php5/bin/phpize

> ./configure --with-php-config=/usr/local/php5/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/

> make

> sudo make install