Php_network_getaddresses: getaddrinfo for failed: Name or service not known

I’m actually setup my Symfony project environment. This is the database setup on .env according to my database info on infinityfree dashboard:

But when I test the database connection with this command “bin/console doctrine:query:sql ‘SELECT 1’”, it shows the error “An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for failed: Name or service not known”

NB: I’m working on Github codespace

External connections are not supported on free hosting:


Thanks. So it would work very well in production?

Unless there is an error with your code, then yes. You won’t know until you try!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.