Skip to main content

How to display errors In PHP?

Website normally will have an error but we can't see the actual reason why it give the error. In order to troubleshoot the problem, we need to find out the reason of the page error. Hence, you are advise to enable or display error page to perform the troubleshooting. I would like to share on how you can enable the error to display. You may kindly refer below on how to add in simple coding to show the error and perform simple troubleshooting from there.

Windows
You may turn on the display error in your application by using the init_set() function which you may refer to the following command to each script.
ini_set('display_errors',1);

Linux
You may turn it on using either :
1. Using init_set() in the application OR
2. Alter the php.ini file by include the following line from your public_html folder:
display_errors=On

Comments