How to display errors in a PHP file ?

PHP

Read {count} times since 2020

When you code PHP some errors might have happened. But you won’t know that and the program don’t work. You can use PHP‘s error_reporting function to display errors. Here’s how to do it:

Create a file named errors.php in the folder where the file with errors exist.
Open the errors.php file in text editor and paste these codes in the file:

error_reporting(E_ALL);
ini_set("display_errors", 1);
include("filename.php");
?>

Replace filename.php with the name of the file that has errors.
Open the errors.php file in browser. You can now see the errors in the file.

Show Comments