How to enable error reporting in PHP?

PHP is widely used web programming language. Sometimes when we run any php script and it’s shows nothing , a blank white screen. It means there is some problem in code. To know the error occurring, we have to enable error reporting.

There are various ways to enable error reporting in php. By default, most of the time error reporting is disabled on sever because we don’t want to show error message or other warnings to our users for worst user experience.

To display error messages caused by your PHP script you can include these lines of code:

ini_set('display_errors',1);
error_reporting(E_ALL);

Above code, will display errors in php code and will help in debugging code.

Another method is to do changes in php.ini file. Below are the steps –