I run an Apache 2.2.22-13 with pecl module "mongo 1.4.4". It connects to a MongoDB 2.4.6 sharded cluster.

When a stepDown occurs, the mongo module seems to stay on the mongod node which was the primary and says: "PHP Fatal error: Uncaught exception 'MongoCursorException' with message 'node1.mongodb.cluster:27017: Remote server has closed the connection' ...

To establish the connection, I tried the 2 following ways:

$m = new MongoClient('mongodb://mongod0.mongodb.cluster, mongod1.mongodb.cluster, mongod2.mongodb.cluster, mongod3.mongodb.cluster', array("replicaSet" => "myrs"));


$m = new MongoClient('mongodb://mongos.mongodb.cluster', array("replicaSet" => "myrs"));

After a stepDown, the two ways give the same error message.

With the first connection string, restarting Apache is enough to get things back on rails. With the last one, restarting doesn't: I don't get any error message anymore but the data that should come from MongoDB is still missing.

Thanks in advance,


  • did you get any solution? – Shakti Singh Feb 23 '14 at 4:03
  • no, I didn't get any solution – Icu Jul 2 '14 at 8:11

I upgraded the mongo pecl module from 1.4.5 to 1.5.8. This problem is fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.