Error using PHP: Could not establish stream for node

I’m trying to connect to Mongo Atlas using PHP and I get the following error:
Could not establish stream for node servername:27017: [connection closed calling hello on 'servername:27017']

I have searched high and low and can’t find anyone with his error exactly. I’ve tried looking at SSL issues, but nothing helped. I am able to connect using mongo cli.

Centos 7 with PHP 7 on Apache 2.

Thank you!

Please post your PHP code including the mogodb uri you are using to connect BUT be sure to obscure your username and password!!

Hello @Everett_Glovier and welcome to the MongoDB community!

It would be nice to have more information, but what you are seeing might be the result of something in the earlier initialization that went undetected. I wrote an article about MongoDB PHP Error handling, that might give you checking ideas.

Let us know!