A Good First Step to Solving Any PHP Problem

On the off chance that you are running into a clear or white page or some other PHP blunder, however you do not understand what’s going on, you ought to consider turning on PHP mistake revealing. This gives you some sign of where or what the issue is, and it is a decent initial step to tackling any PHP issue. You utilize the error_reporting capacity to turn on mistake revealing for a particular document that you need to get blunders on, or you can empower mistake detailing for every one of your records at your web server by altering the php.ini record. This spares you the anguish of going more than a large number of lines of code searching for a blunder.

PHP Error_reporting Function 

The error_reporting() work builds up the error reporting criteria at runtime. Since PHP has a few dimensions of reportable errors, this capacity sets the ideal dimension for the span of your content. Incorporate the capacity right off the bat in the content, more often than not following the opening <?php. You have a few options, some of which are outlined beneath:

<?php
//Report simple run errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//Report E_NOTICE in addition to simple run errors
//(to catch uninitialized variables or variable name misspellings)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
//Report all PHP errors error_reporting(-1);
//Report all PHP errors (see changelog) error_reporting(E_ALL);
//Turn off all error reports error_reporting(0);
?>

How to Display Errors

Display_error determines whether errors are printed on the screen or hidden from the user. It is used in conjunction with the error_reporting function as shown in the example below:

ini_set(‘display_errors’,1); error_reporting(E_ALL);

Changing the php.ini File at the Website

To see all error reports for all your files, go to your web server and access the php.ini file for your website. Add the following option:

error_reporting=E_ALL

The php.ini file is the default configuration file for running applications that use PHP. By placing this option in the php.ini file, you are requesting error messages for all your PHP scripts.