Getting 500 server error with Laravel 5.7 on Windows

27,842

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:

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

Solution 3

I just missed .env file.

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

Share:
27,842
domanskyi
Author by

domanskyi

Updated on July 20, 2022

Comments

  • domanskyi
    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
      nakov over 5 years
      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.
    • RiggsFolly
      RiggsFolly over 5 years
      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 questions
    • domanskyi
      domanskyi over 5 years
      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\\Ill‌​uminate\\Encryption\‌​\EncryptionServicePr‌​ovider.php:44) [stacktrace]
    • Ilmari Karonen
      Ilmari Karonen over 5 years
  • Rohwedder
    Rohwedder over 3 years
    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:generate
  • Rohwedder
    Rohwedder over 3 years
    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:generate