6

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]

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
domanskyi
  • 701
  • 1
  • 6
  • 19
  • 1
    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. – nakov Dec 24 '18 at 16:00
  • 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___ – RiggsFolly Dec 24 '18 at 16:01
  • 1
    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] – domanskyi Dec 24 '18 at 16:06
  • 1
    Possible duplicate of [No Application Encryption Key Has Been Specified](https://stackoverflow.com/questions/44839648/no-application-encryption-key-has-been-specified) – Ilmari Karonen Dec 24 '18 at 16:10

3 Answers3

18

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

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
Anand Mainali
  • 993
  • 1
  • 14
  • 23
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.

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
  • 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:generate` – Martin Rohwedder Jan 16 '21 at 14:18
2

I just missed .env file.

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

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
domanskyi
  • 701
  • 1
  • 6
  • 19
  • 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` – Martin Rohwedder Jan 16 '21 at 14:17