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

arif's avatar
Level 1

database error

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

i am getting this error.

0 likes
4 replies
Snapey's avatar

what have you in .env?

How are you hosting mysql?

arif's avatar
Level 1

DB_HOST = exampleserver.net DB_DATABASE = assignment DB_USERNAME = assignment DB_PASSWORD = password

i am connecting to remote server. it was working fine but suddently i got this issue.

fideloper's avatar

Did this resolve by itself? This is a DNS issue - PHP can't resolve the database hostname exampleserver.net to an IP address.

It may not be a real domain (typo? incorrect domain?), but for whatever reason where ever your laravel app is being run, it can't resolve your database hostname to an address.

hoohost's avatar

So how do you see what address PHP is trying to resolve?

1 like

Please or to participate in this conversation.