CloudStore Support
Hi,
I’m trying to connect from my PHP application to MongoDB instance located in FRA1, but I get this errorr:
No suitable servers found (serverSelectionTryOnce set): [connection error calling hello on ‘[app]-a000d008.mongo.ondigitalocean.com:27017’]
I’m using PHP 8 with ext v.1.10, MongoDB Server is the 4.4. The strange thing I see is that the DNS of my connection string (grab from my DO Panel) is [app]-f821f828.mongo.ondigitalocean.com but the one but the error talks about [app]-a000d008.mongo.ondigitalocean.com.
No problem if I try to connect to my instance using clients like MongoDBCompass or Robot3T.
What does that error means? Thaks in advance, CloudStore
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Could you share your PHP connection string that you are using? Make sure to remove any sensitive information before posting it here.
Also I would recommend trying to add +srv to your connection string as follows:
$db = new MongoDB\Client('mongodb+srv://[myapp].mongo.ondigitalocean.com', array(
'username' => 'doadmin',
'password' => '[password]',
'db' => '[database]',
'authSource' => 'admin',
'replicaSet' => '[replica]',
'tls' => 'true',
'tlsCAFile' => '/usr/share/ca-certificates/app/ca-certificate.pem'
));
Best, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.