[转] mac os 下RabbitMq 以及 PHP amqp扩展安装记录

brew 这个命令我还真是第一次知道。

----------------------------------------------

转载请注明: 转载自Yuansir-web菜鸟 | LAMP学习笔记

本文链接地址:mac os 下RabbitMq 以及 PHP amqp扩展安装记录

记录一下安装配置的过程,这里我都是直接用brew来安装,如果没有安装先安装:

1/usr/bin/ruby -e"$(curl -fsSL https://raw.github.com/gist/323731)"

1.首先就是安装rabbitmq了,简单,因为rabbitmq是依赖erlang,所以安装中会下载并且安装erlang,下载编译时间可能会有点长,稍安勿躁:

1brew update
2brewinstallrabbitmq

2.安装rabbitmq-c,C与RabbitMQ通信需要依赖rabbitmq-c库(librabbitmq),具体请看https://github.com/alanxz/rabbitmq-c

1git clone git://github.com/alanxz/rabbitmq-c.git
2mkdirbuild &&cdbuild
3cmake -DCMAKE_INSTALL_PREFIX=/usr/local..
4cmake --build . --targetinstall

3.接下来就是安装php amqp的扩展了:

你可以源码编译安装

1wget http://pecl.php.net/get/amqp-1.0.0.tgz
2tarzxvf amqp-1.0.0.tgz
3cdamqp-1.0.0
4/usr/local/php/bin/phpize
5./configure –-with-php-config=/usr/local/php/bin/php-config -–with-amqp
6make&&makeinstall

当然也可以直接用PECL来装, 如果还没有安装pear的话:

1wget http://pear.php.net/go-pear.phar
2php -d detect_unicode=0 go-pear.phar

然后直接用pecl来安装扩展

1~/pear/bin/peclinstallamqp

最后将‘extension=amqp.so’加入php.ini,重启apache,再查看下:

1php -i |grepamqp

已经装好了!