How to show all errors in PHP?

Learn how to show all errors in PHP while developing web applications?

How to show all errors in PHP?

How to show all errors in PHP?

I this tutorial I will explain you how you can make changes in your code for displaying all the warning and error messages in your PHP program. This is one of the most asked question "How to show all errors in PHP?" by the PHP developers. As it is necessary to see all the errors while developing PHP programs.

What change I should make in the code for displaying all the errors and warning message while developing PHP based applications?

It is very easy to instruct the PHP to display all the errors and warning messages. You can have to add the three lines of code in your PHP program. You can create a include file and then include the file using following code:

<?php
include_once "mycommonsettings.php";
?>

You can include the following code in mycommonsettings.php file:

<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
?> 

Above code instructs the PHP to report all the errors and warning messages.

You can remove the error reporting code before moving your code on the production environment.

This is one of the best way to report errors in PHP programs while developing the PHP web applications. This will save a lot of time in finding and fixing the bugs.

Check PHP tutorials section for huge collection of PHP and MySQL examples.