Bobby's Blog

Nice PHP snippet for extra debugging – especially useful for lots of CMSs (WP/Joomla/Concrete5/etc.)

PHP-snippet

If you’ve ever struggled to get your CMS 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.

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


Here’s an example, something broke my blog page and my blog posts are not displaying:

White screen - debigging


Even though I have PHP display errors on there are no errors being displayed.

After adding the the PHP snippet on top of my index.php file I was able to see the exact error causing the issue:

Error reporting

After I knew the exact error that was causing the issue I was able to fix it and get my blog back up and running.

Some CMSs like WordPress 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!


About the author

Bobby

Linux System Administrator