title: PHP AMQP Consume() fork to do actual work
body: <p>I'm looking to have a PHP script that consumes (using the PECL AMQP module) from a RabbitMQ queue and then forks off to do the actual work.</p>
  <p>I've got code @ <a href="https://gist.github.com/giggsey/6666e67bb0e090eeb5f0" rel="nofollow noreferrer">https://gist.github.com/giggsey/6666e67bb0e090eeb5f0</a></p>
  <p>But when I run it, I get:</p>
  <blockquote>
  <p>11296 Key: USER.12392   ObjectLength: 74 Forked 11296 at 2013-03-19</p>
  <p>14:16:22 11277 ack() PHP Fatal error:  Uncaught exception</p>
  <p>'AMQPConnectionException' with message 'Connection reset by peer' in tmp/forking.php:10</p>
  <p>Stack trace:</p>
  <p>0 tmp/forking.php(10): AMQPQueue-&gt;consume(Array)</p>
  <p>1 tmp/forking.php(102): test-&gt;run()</p>
  <p>2 {main}   thrown in tmp/forking.php on line 10</p>
  <p>Fatal error: Uncaught exception 'AMQPConnectionException' with message
  'Connection reset by peer' in tmp/forking.php on line 10</p>
  <p>AMQPConnectionException: Connection reset by peer in tmp/forking.php on line 10</p>
  <p>Call Stack:</p>
  <pre><code>0.0006     665008   1. {main}() tmp/forking.php:0
  
  0.0007     665456   2. test-&gt;run() tmp/forking.php:102
  
  0.0359     670504   3. AMQPQueue-&gt;consume() tmp/forking.php:10
  </code></pre>
  </blockquote>