Laravel: Enable Proper Error Display

By default, you will see the following message in case any error occurs in your Laravel application:

Whoops, looks like something went wrong.
Whoops, looks like something went wrong.

To show the exact error message details, you need to follow the steps below:

  • Go to your Laravel root folder
  • Rename .env.example to .env

After this, when you refresh your web page, you might see the following error message details:

No supported encrypter found. The cipher and / or key length are invalid.

Now, at least you got the error details. The error means that the encryption key for your Laravel application has not been generated yet. To generate the key, you need to run the following command:

  • Open terminal or command prompt
  • Go to your Laravel root folder (e.g. cd /var/www/laravel)
  • Run the following command:
php artisan key:generate
  • You will see the message on terminaly saying application key set successfully.
  • This will update .env file present in your laravel root folder. In that file, it will set the value of APP_KEY.

Now, when you browser your Laravel site, you should see your page without any error.

Hope this helps. Thanks.