'No suitable servers found (`serverSelectionTryOnce` set) while trying to make connection with mongoDB in php code
I have a php application which is deployed on google app engine , and I want to integrate my application with mongoDB database,
So for the same, I have installed a mongoDB VM in my GAP, so the instance obviously has internal and external IP,
To make a connection , in mongoDB VM I have edited the file mongod.conf file , in which I have added internal IP of my VM to bindIP part, along with security enabled also.
So when I check the connection using below connection string in my php code
mongodb://10.172.0.5:27017/?authSource=admin (where 10.172.0.5 is the internal IP of mongoDB VM and admin is the database)
I get below error
Fatal error: Uncaught MongoDB\Driver\Exception\ConnectionTimeoutException: No suitable servers found (`serverSelectionTryOnce` set): [connection timeout calling hello on '10.172.0.5:27017']
so what should I to make a successful connection
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
