Getting 500 server error with Laravel 5.7 on Windows

domanskyi picture domanskyi · Dec 24, 2018 · Viewed 17.8k times · Source

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]

Answer

Anand Mainali picture Anand Mainali · Dec 24, 2018

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