Skip to content

Cannot connect to MongoAtlas #362

@ghost

Description

Setup:
PHP 7.1
Latest mongo-php-library

Use case:
I am trying to connect to MongoAtlas, free tier, from a simple PHP script. To do this I am using the following (sanitised) constructor.

$client = new MongoDB\Client("mongodb://USER:PASSWORD@CLUSTER-shard-00-02-7pxcd.mongodb.net:27017,CLUSTER-shard-00-01-7pxcd.mongodb.net:27017,CLUSTER-shard-00-02-7pxcd.mongodb.net:27017/DATABASE?ssl=true&replicaSet=CLUSTER-shard-0&authSource=admin");

When doing so, I receive the following error.

[06-May-2017 12:58:23 Europe/London] PHP Fatal error: Uncaught MongoDB\Driver\Exception\ConnectionTimeoutException: No suitable servers found (serverSelectionTryOnce set): [socket timeout calling ismaster on 'CLUSTER-shard-00-02-7pxcd.mongodb.net:27017'] [socket timeout calling ismaster on 'CLUSTER-shard-00-01-7pxcd.mongodb.net:27017'] [socket timeout calling ismaster on 'CLUSTER-shard-00-02-7pxcd.mongodb.net:27017'] in /vendor/mongodb/mongodb/src/Collection.php:749
thrown in /home/tomntech/public_html/test/vendor/mongodb/mongodb/src/Collection.php on line 749

I have read through numerous Issues in the Github repo but cannot seem to identify one demonstrating the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions