[rabbitmq-discuss] How can I set socket timeouts in PHP using the AMQP PHP extension?

Keith Krueger keith at krue.gr
Tue Jun 28 23:44:47 BST 2011

I am using the PHP AMQP extension, as described here:


This PHP extension uses the rabbitmq-c library as its underlying

I would like to set socket timeouts for connection establishment and for
each of my enqueues and dequeues. I want to do this in case our server
performance degrades, to allow the clients to fail quickly rather than hang.

Does anyone have experience doing this in a PHP environment?  I have tried
setting the PHP socket timeout as follows.

  ini_set('default_socket_timeout', 5);

This appears to have no impact on the PHP extension's timeout settings. I am
still able to enqueue a multi-megabyte MQ message to rabbitmq without losing
the socket connection. It takes about 75 seconds to enqueue this message,
but the socket is kept open the entire time.

Is there any support either in the PHP AMQP extension or in a different PHP
setting that I can use to reduce the timeouts for our interactions with
RabbitMQ?  I'd rather not live with a potential problem of hanging client
processes if I can avoid it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110628/996b475d/attachment.htm>

More information about the rabbitmq-discuss mailing list