How to enable error reporting in Magento 2

As developers, we always need to see the error while developing extensions or solving the bugs. Many times you just see the blank page on Magento and wonder what will be the issue.

In the default setting of Magento 2, the function which allows displaying the error on the frontend is disabled so here is the way to see the error and enable the error reporting in Magento2.

The number one thing that we always do as developers is enable the Developer mode on the following magento command

php bin/magento deploy:mode:set developer

if you are still unable to see the error then you just need to edit app/bootstrap.php(from root of your magento directory)

Find following the code in above file set as following

error_reporting(E_ALL); // Set Error Reporting as E_ALL (Report all PHP errors)

ini_set('display_errors', 1); // Uncomment this line to enable PHP error display

You will see all the errors on the browser now.

Happy Coding !

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Reply

Your email address will not be published.