Enable PHP errors to Display on Web Browser

Generally, displaying PHP errors in a web browser is not a good idea as hackers cannot collect information about your website.

However, when performing development or testing displaying PHP error may be very useful for troubleshooting purposes. This article will help you to enable PHP errors to display on the web browser.

See Also:

Enable display_errors

First, we need to enable display_errors parameters using the PHP configuration file.

# vim /etc/php.ini
display_errors = on

Add Content in PHP script

After enabling display_errors to add the following line in your application index.php file or other default load script.

ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1);

Here is a sample of index.php file with enabled PHP errors to display on the web browser.

Enjoy it!

No Responses

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.