Getting 500 server error with Laravel 5.7 on Windows [closed]
Asked Answered
G

3

7

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]

Gath answered 24/12, 2018 at 15:55 Comment(4)
Please 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.Intinction
There could be any number of reasons for this. But unless you give us more information there is little we can do but play 20 questionsBelak
There 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]Gath
Possible duplicate of No Application Encryption Key Has Been SpecifiedWinifield
J
12

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.

Jalapa answered 24/12, 2018 at 16:8 Comment(1)
My 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 command php artisan key:generateNutlet
R
19

When you clone the git repo you must follow these steps to run the project:

  1. Create a Database locally
  2. 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 )
  3. Open the console and cd your project root directory
  4. Run composer install
  5. Run php artisan key:generate
  6. Run php artisan migrate
  7. Run php artisan db:seed to run seeders, if any.
  8. Run php artisan serve

Now, your project will run. Good Luck!!

Rodie answered 24/12, 2018 at 18:10 Comment(0)
J
12

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.

Jalapa answered 24/12, 2018 at 16:8 Comment(1)
My 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 command php artisan key:generateNutlet
G
2

I just missed .env file.

I have created new and generated a new key using php artisan key:generate

Gath answered 24/12, 2018 at 16:10 Comment(1)
Yes. 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 command php artisan key:generateNutlet

© 2022 - 2024 — McMap. All rights reserved.