Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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]

like image 893
domanskyi Avatar asked Dec 24 '18 15:12

domanskyi


2 Answers

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!!

like image 71
Anand Mainali Avatar answered Nov 16 '22 15:11

Anand Mainali


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.

like image 12
Udhav Sarvaiya Avatar answered Nov 16 '22 14:11

Udhav Sarvaiya