Enable and Disable Debug Mode in Laravel

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.

Recommended Laravel Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *