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

gemilyd's avatar

Laravel error 500, welcome page not loading

I'm currently having problem with loading Laravel welcome page. Instead, I get error 500, there is nothing in the log so I don't even know what's wrong with. This is my first time using laravel, anyone has an idea on how to fix this?

0 likes
10 replies
catinodev's avatar

Verify that you have a .env file in the root of the project.

kundefine's avatar

check your .env file for APP_KEY present if not generate it with this command -> php artisan key:generate Example: APP_KEY=base64:BIS6IJfT/vskVdfdQPjlxBM+yiNvwfaNLqDLFkAlaRU=

Ty's avatar

you need to have an .env laravel does supply a .env.example as just a boilerplate example. You need to make sure you have a .env that is configure to your actual setup you wish to have. This is also where you will set your database variables.

1 like
gemilyd's avatar

This is what my .env.example file has

APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost

gemilyd's avatar
C:\Users\wembalongeg\Website>php artisan key:generate

   ErrorException  : file_get_contents(C:\Users\wembalongeg\Website\.env): failed to open stream: No such file or directory

  at C:\Users\wembalongeg\Website\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:96
     92|     {
     93|         file_put_contents($this->laravel->environmentFilePath(), preg_replace(
     94|             $this->keyReplacementPattern(),
     95|             'APP_KEY='.$key,
  >  96|             file_get_contents($this->laravel->environmentFilePath())
     97|         ));
     98|     }
     99|
    100|     /**

  Exception trace:

  1   file_get_contents("C:\Users\wembalongeg\Website\.env")
      C:\Users\wembalongeg\Website\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:96

  2   Illuminate\Foundation\Console\KeyGenerateCommand::writeNewEnvironmentFileWith("base64:wxWLyECKn6MRRY4YIEA7VoWS2+Ur/57wQQtwiDEBhlg=")
      C:\Users\wembalongeg\Website\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:80

this is what I get when I do: "php artisan key: generate"

fkeloks's avatar

It is missing a .env file in C:\Users\wembalongeg\Website

Ty's avatar

@gemilyd you need to read my comment and this will fix your issue. You cannot use a .env.example.

1 like
gemilyd's avatar

Thanks, I created a .env file and copied everything that was in .env.example in it. I ran

php artisan key:generate

it successfully generated the key then I did

php artisan serve```

Please or to participate in this conversation.