mongo-php-library: Can't connect to Atlas - Error:No suitable servers found

I’m having trouble connecting to Atlas as well with PHP. Connect fine using other libs and MongoChef so whitelisting is not the issue.

  • Windows 10
  • PHP 5.6.29
  • mongodb.dll ext 1.2.2
  • “mongodb/mongodb”: “^1.1.0” from composer
  • Atlas cluster running MongoDB 3.2
Error fetching Mongo. DB:myDB Coll:myCollection Error:No suitable servers found (`serverSelectionTryOnce` set): 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed calling ismaster on 'myShard.mongodb.net:27017'] 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed calling ismaster on 'myShard.mongodb.net:27017'] 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_serve query:{"theField":"theValue"} fields:{"projection":{"_id":1,"theField":1}}
exception 'MongoDB\Driver\Exception\ConnectionTimeoutException' with message 'No suitable servers found (`serverSelectionTryOnce` set): 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed calling ismaster on 'myShard.mongodb.net:27017'] 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed calling ismaster on 'myShard.mongodb.net:27017'] 
[TLS handshake failed: error:14090086:SSL routines:ssl3_get_serve' in C:\theapp\vendor\mongodb\mongodb\src\Collection.php:498
Stack trace:
#0 C:\theapp\vendor\mongodb\mongodb\src\Collection.php(498): MongoDB\Driver\Manager->selectServer(Object(MongoDB\Driver\ReadPreference))
#1 C:\theapp\MyMongoClass.php(143): MongoDB\Collection->find(Array, Array)

The sanitized url:

mongodb://theUser:thePassword@myShard.mongodb.net:27017,myShard.mongodb.net:27017,myShard.mongodb.net:27017/admin?ssl=true&replicaSet=myReplicaset&authSource=admin

Posted as suggested

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

@Jeff-Lewis: 1.2.3 was released yesterday with the fix. You’ll find Windows DLLs here.

https://github.com/mongodb/mongo-php-library/issues/313 bumps our libmongoc dependency, so we should have this fix released in 1.2.3 sometime next week.