Rabbit MQ Installation
> echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list
> wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
> sudo apt-key add rabbitmq-signing-key-public.asc
> apt-get update
> apt-get install rabbitmq-server -y
> service rabbitmq-server start
> rabbitmq-plugins enable rabbitmq_management
> rabbitmqctl add_user admin password
> rabbitmqctl set_user_tags admin administrator
> rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
> rabbitmqctl delete_user guest
> service rabbitmq-server restart
Make sure you change the word "password" to the actual password you want to login with in the add_user line before running. The default port for the admin interface is 15672. You can use the management interface to finish off your configuration such as adding exchanges, queues, users and vhosts. Make sure to open the correct firewall ports (15672, 5672) if you are going to be accessing the box outside of a VPN or localhost. Reference : http://marcqualie.com/2012/12/install-rabbitmq-on-ubuntu-12.04
After that,
> wget http://pecl.php.net/get/amqp-1.2.0.tgz
> tar -xzf amqp-1.2.0.tgz
> cd amqp-1.2.0
> phpize && ./configure --with-amqp && make && sudo make install
Now we can try following example on our server.
> wget https://gist.github.com/hkulekci/6087182/raw/69e463cd83df9b2db0b7a524dbe17895fbe0c2f6/php-receive.php
> wget https://gist.github.com/hkulekci/6087182/raw/3c0586ad197cec293681f72276f9a1e8201ebcef/php-send.php
> php -f php-send.php
Message sent!
> php -f php-receive.php
New Message
Custom Message (ts): 1374827679
Thats all.