Verify that you have a .env file in the root of the project.
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?
I do have the .env.example.
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=
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.
This is what my .env.example file has
APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost
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"
It is missing a .env file in C:\Users\wembalongeg\Website
@gemilyd you need to read my comment and this will fix your issue. You cannot use a .env.example.
copy .env.example to .env and then run the artisan command again
Please read though the installation instructions. They are not long and cover these steps (and others)
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.