Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Corys8646's avatar

Random php_network_getaddresses: getaddrinfo failed on Digital Ocean

Spent a little time trying to dig into this problem today, but not having much luck (not a server person).

I have 3 sites Site A: AWS EC2 Hosted Site B: DO Droplet 1 Site C: DO Droplet 2

All sites are different code, but all on laravel.

All sites connect to the same AWS RDS Database.

Side A connects to one particular table Site B,C connect to a different table

Site B and C are on different droplets within digital ocean

On the two Digital Ocean servers I am getting random errors in my logs relating to connecting to the database.

[2017-02-23 10:25:33] production.ERROR: exception 'ErrorException' with message 'PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known' in /home/forge/XXXX.XXX/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

There doesn't seem to be any commonality that I can find regarding the errors (time of day, heavy load etc). And there is nothing in the mysql logs on the RDS instance.

The site on EC2 doesn't have any problems in it's log

None of the sites are used heavily and all the resources on the RDS side look to have plenty of headroom.

Any suggestions on where I should start looking?

TIA

0 likes
2 replies
fideloper's avatar

Did this resolve itself? Sounds like Amazon may have had issues with DNS resolution for the RDS hostnames. Perhaps the database was failing over to a secondary? (if you have a multi-az deployment enabled on the RDS database).

Corys8646's avatar

not a multi-az deployment, but yes the last few days I haven't been seeing anything in the logs. hopefully it's been resolved!

Thanks

Please or to participate in this conversation.