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

graham's avatar
Level 12

Error Deploying to Forge (Database connection denied)

I'm trying to deploy a site to Forge but I'm having a few problems.

If I check the deployment log on the server I see an error

exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES)' in /home/forge/dev.grahams.com/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47

The strange thing is the DB_HOST is set as an Environment variable to 127.0.0.1

When I check "Edit nginx configuration" there's no sign of any of the ENV variables I set via forge. It's as if forge is completely ignoring the environment variables.

Any suggestions would be very welcome. Thanks

0 likes
2 replies
bashy's avatar

So you set the env vars inside Forge?

graham's avatar
Level 12

Thanks for the reply bashy.

I had set the env vars inside Forge but that didn't appear to stop me pasting them in wrong. Unsurprisingly, when I put the correct values in, it worked :-)

Please or to participate in this conversation.