Getting 500 server error with Laravel 5.7 on Windows
Solution 1
Answer based on your comment under in your question:
RuntimeException No application encryption key has been specified.
set a value for the APP_KEY
variable.
At the command line, the following Artisan command to generate a key:
php artisan key:generate
This will generate a random key, you must restart the server and you should no longer see the error message.
Solution 2
When you clone the git repo you must follow these steps to run the project:
- Create a Database locally
- Rename .env.example file to .env inside your project root and fill the database information. (windows won't let you do it, so you have to open your console cd your project root directory and run mv .env.example .env )
- Open the console and cd your project root directory
- Run
composer install
- Run
php artisan key:generate
- Run
php artisan migrate
- Run
php artisan db:seed
to run seeders, if any. - Run
php artisan serve
Now, your project will run. Good Luck!!
Solution 3
I just missed .env file.
I have created new and generated a new key using php artisan key:generate
domanskyi
Updated on July 20, 2022Comments
-
domanskyi almost 2 years
I have cloned repo from git, and made
composer install
.Then I am starting a server, but every time I get 500 server error.
Also, I tried to create a new project with
composer create-project --prefer-dist laravel/laravel blog
and this project works fine.In my error log i got an error like:
production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at C:\OSPanel\domains\contact-fw-domanskyi\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:44) [stacktrace]
-
nakov over 5 yearsPlease share what you have in your log to get a better help, just 500 doesn't says a lot. You can check the error log within your project
storage/logs
directory. -
RiggsFolly over 5 yearsThere could be any number of reasons for this. But unless you give us more information there is little we can do but play 20 questions
-
domanskyi over 5 yearsThere are many same errors: production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at C:\\OSPanel\\domains\\contact-fw-domanskyi\\vendor\\laravel\\framework\\src\\Illuminate\\Encryption\\EncryptionServiceProvider.php:44) [stacktrace]
-
Ilmari Karonen over 5 yearsPossible duplicate of No Application Encryption Key Has Been Specified
-
-
Rohwedder over 3 yearsYes. My problem was also .env was missing. I was doing this in the terminal.
cp .env.example .env
To make a fresh .env and then I ran the artisan commandphp artisan key:generate
-
Rohwedder over 3 yearsMy problem was .env was missing. I was doing this in the terminal.
cp .env.example .env
To make a fresh .env and then I ran the artisan commandphp artisan key:generate