PHP: Show PHP error messages when PHP error reporting is disabled

Adding the following code to the top of your PHP script will allow that page to show PHP error messages and override the php.ini defaults. This is a good and simple way to quickly debug a page without having to adjust your main PHP config (which isn’t always possible).

It is good practice to have PHP error messages disabled in the main config file mainly for security reasons, the error messages shown could be used by hackers to gather information and vulnerabilities of your website. I would only advice adding this code temporarily while you are developing or debugging issues.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.