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

Hameed's avatar
Level 14

Unable to deploy a test application in Forge

Hi Guys, I am new to forge and I am trying to deploy a test application but I keep getting an error related to database user configuration. When I had a look at my .env file in forge it is empty so my questions are

  • do I need to generate the whole .env file or I only need to update variables needed such as the database configurations.
  • Does forge create a default .env file when creating a website and if yes how can I view this file?
0 likes
10 replies
azimidev's avatar

When you use forge, it will create a default .env file for your app with database username forge and a secure password which it will email you. Keep that email which is very important. You don't need to generate an .env file. In Environment tab, update your credentials.

Hameed's avatar
Level 14

In the environment tab, the only option I have is updating the .env file. When I open the file it is empty. Do you mean I need to update the database connection configurations in this file?

Excuse my lack of knowledge again

azimidev's avatar

No problem. It's weird that is empty. Yes update that file exactly the same as your .env file. also you need to change these variables like so:

APP_ENV=production
APP_DEBUG=false
APP_KEY=for_this_type_php_artisan_key_generate

for APP_KEY you will need to type php artisan key:generate in your app console and grab that key and paste it in there.

Usually forge will create that file and does it for you but I don't know why you don't have it.

Hameed's avatar
Level 14

Hmm, weird! So here is what I did:

  • Under my application, I opened the "Environment" tab
  • I clicked on "Edit Environment" option
  • I got an empty file and updated with all configurations making sure that the database options matching the one I received from forge.
  • Opened the application tab, selected the required repository to deploy and hit the "install repository"
  • But I am still getting the error "Access denied for user 'forge'@'localhost' (using password: NO)")"
Cronix's avatar

It sounds like you didn't fill in DB_PASSWORD=passwordForgeEmailedToYou in your .env

Hameed's avatar
Level 14

I actually did but I am still getting the same error. What I don't understand is why the .env file is always empty each time I open it. It does not keep my update. Is that normal?

Cronix's avatar

No, it's not normal, just like it's not normal to have an empty .env when the site is created.

Personally, I'd delete the site and try creating a new one from scratch. It sounds like something is wrong with permissions or something.

Hameed's avatar
Level 14

I did that but I still get an empty .env file.

Cronix's avatar

Ok, I'd contact forge support at this point. It's the big blue circle icon in the lower-right hand corner of the screen when you're logged into your forge account.

Hameed's avatar
Level 14

Thanks a million guys for the support! will do that

1 like

Please or to participate in this conversation.