By default debug mode in laravel .env file is disabled, just open .env file from laravel project root directory, find APP_DEBUG
, and change true to enable debug mode.
How to Enable and Disable Debug Mode in Laravel App
Here are two methods, using these you can easily enable and disable debug mode in your laravel app:
Method 1 – Enable or Disable Mode using .env File
In the first method, navigate to your Laravel app root directory and open .env file. Follow these steps to enable and disable debug mode.
Enable Debug .evn File
Laravel provides APP_DEBUG
flag in .env file to handle application debug mode, default it true
and when you change to false
it means you are disabling debug mode.
Search APP_DEBUG
key in .env
file and change true to enable debug mode and false
for disable debug mode.
APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=single
Disable Debug in .evn File
Set the APP_DEBUG environment variable value to false
in the .env
environment configuration file.
APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=false APP_URL=http://localhost LOG_CHANNEL=single
Method 2 – Enable or Disable Mode using app.php
In the second method, navigate to your Laravel project config directory and open app.php file. Follow these steps to enable and disable debug mode.
Enable Debug in app.php
Set the APP_DEBUG environment variable value to true
in the app.php
file.
'debug' => env('APP_DEBUG', true),
Disable Debug in app.php
Set the APP_DEBUG environment variable value to false
in the app.php
file.
'debug' => env('APP_DEBUG', false),
Conclusion
That’s it, In this tutorial, you have learned how to enable and disable debug mode in laravel apps.