How to enable PHP error reporting on web browser
Last Modified at 2019-09-18 17:15:01
This tutorial is very much helpful for you if you are debugging an existing project or you are making a new project live, and suddenly your project stopped working, and you want to see errors on your web browser. There are two ways to display errors. The first one is to display error on the web browser directly and the second one is to enable error logging somewhere in text format, known as 'error_log' file. This article will cover the first method that enables error reporting on the web browser. Although, we always recommend not to enable error reporting for the web browser on the live environment because that may cause security issues.
First of all, enable the 'display_errors' variable setting in your server's php.ini file.
Post, add below lines of code into your PHP file on the top of code or you may also create a config.php file and put below code in it and you can include this in any of your PHP files to enable error reporting.
Below is the example of placing the above code into the file.