PHP MongoDB fatal error: Read timed out
Asked Answered
C

1

7

sometimes there is a bug (~30%):

Failed to connect to: IP:2333: Read timed out after reading 0 bytes, waited for 0.000000 seconds

  • Web server Apache/2.2.16
  • PHP version PHP 5.3.3-7+squeeze15
  • PHP extension mongo/1.4.0
  • MongoDB version 2.2.3

In all cases. What is this?

Catechu answered 10/7, 2013 at 17:29 Comment(0)
A
1

I had the exact same bug. The solution is to set a timeout for your requests.

  • You can do a $cursor->timeout(-1); on each of your cursors.

  • Or simply add MongoCursor::$timeout = -1; in your index/connection file.

-1 is to set an infinite timeout. You can also put a value in milliseconds if you don't want infinite.

Adeno answered 7/10, 2015 at 1:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.