天天看点

【AMQP】macOS下的AMQP服务器以及PHP扩展搭建环境说明前期准备安装RabbitMQ扩展添加到本地PATH安装 RabbitMQ management UI用户管理安装AMQP扩展继续安装rabbitmq-c继续安装AMQP编写测试代码总结参考资料

macOS版本, macOS Sierra 10.12.3 (16D32)

PHP集成环境, XAMPP 7.0.15-0

Apache 2.4.25,

MariaDB 10.1.21

PHP 7.0.15

在文件的最上面添加<code>/Applications/XAMPP/xamppfiles/bin</code>

重启中端

报错 ERROR: epmd error for host bogon: timeout (timed out)

修改hosts , 增加 <code>127.0.0.1 bogon</code>

继续

添加所在sbin路径<code>/Applications/XAMPP/rabbitmq_server-3.6.6/sbin</code>

重启终端

再次启动服务

<code>rabbitmq-server</code>

这个图形化界面是一个插件

重启服务后,就会变成<code>completed with 6 plugins.</code>

访问图形化登录界面的地址为<code>http://localhost:15672/</code>

之后就可以登录图形化管理界面了

在创建用户的之后,需要通过标签的形式给用户赋予对应的权限

administrator | monitoring | policymaker | management |

Comma-separated list of tags to apply to the user. Currently supported by the management plugin: - management User can access the management plugin - policymaker User can access the management plugin and manage policies and parameters for the vhosts they have access to. - monitoring User can access the management plugin and see all connections and channels as well as node-related information. - administrator User can do everything monitoring can do, manage users, vhosts and permissions, close other user’s connections, and manage policies and parameters for all vhosts. Note that you can set any tag here; the links for the above four tags are just for convenience.
`aclocal’ is part of automake package, try to install it first.

所以需要重新安装<code>automake</code>

修改配置文件

重启服务器

创建 <code>composer.json</code>文件

在项目所在目录执行<code>composer install</code>

配置文件<code>config.php</code>

demo文件<code>test.php</code>

命令行运行代码<code>php test.php</code>,得到debug信息,和正确的返回

到此,环境配置完成

本次配置环境涉及到了

不同bash下的环境变量的修改

软件环境的相互依赖关系

编译的报错以及排查

出现问题之后的问题搜索技巧

只要可能出问题就一定出问题的墨菲定律

<a href="http://pecl.php.net/package/amqp">http://pecl.php.net/package/amqp</a>

<a href="http://www.php.net/manual/pl/book.amqp.php">http://www.php.net/manual/pl/book.amqp.php</a>

<a href="http://www.infoq.com/cn/articles/AMQP-RabbitMQ/">http://www.infoq.com/cn/articles/AMQP-RabbitMQ/</a>

<a href="http://www.th7.cn/system/mac/201409/70274.shtml">http://www.th7.cn/system/mac/201409/70274.shtml</a>

<a href="http://www.rabbitmq.com/download.html">http://www.rabbitmq.com/download.html</a>

<a href="http://stackoverflow.com/questions/9520914/installing-amqp-through-pecl">http://stackoverflow.com/questions/9520914/installing-amqp-through-pecl</a>

<a href="https://github.com/alanxz/rabbitmq-c">https://github.com/alanxz/rabbitmq-c</a>

<a href="http://www.cnblogs.com/hurricane2011/articles/2503582.html">http://www.cnblogs.com/hurricane2011/articles/2503582.html</a>

<a href="http://blog.csdn.net/sky_qing/article/details/9707647">http://blog.csdn.net/sky_qing/article/details/9707647</a>

<a href="https://github.com/facebook/redex/issues/22">https://github.com/facebook/redex/issues/22</a>

<a href="https://www.openssl.org/">https://www.openssl.org/</a>

<a href="https://github.com/pdezwart/php-amqp">https://github.com/pdezwart/php-amqp</a>

<a href="https://github.com/php-amqplib/php-amqplib">https://github.com/php-amqplib/php-amqplib</a>