PHP snippet for extra debugging

If you've ever struggled to get your CMS like WordPress, Joomla, Magento or website display any errors, you will definitely find this snippet helpful.

I personally use this a lot and I would like to share this with more people.

Usage: Add this on top of your index.php file or the file that is not displaying any errors:

// Debug - Add this on top of your index.php file

ini_set('error_reporting', E_ERROR);
function fatal_handler() {
    $error = error_get_last();

Some CMSs come with built in debug mode, but in case your CMS doesn't offer that out of the box, you could simply use this snippet - it has helped me a lot!

© 2020 DevDojo LLC. All rights reserved.