HomePHP & MySQLHow to display PHP errors at runtime with a simple code Aner Barrena September 20, 2020 PHP & MySQL Many servers do not display PHP errors by default, so many times when not getting the expected result or performance we don´t know which line of code is giving error. With the following functions placed at the beginning of our PHP files we will show the PHP errors: PHP <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> 1234 <?phperror_reporting(E_ALL);ini_set('display_errors', '1');?> Additionally I put more example code to show or not to display the errors of PHP: PHP <?php // Show all PHP errors error_reporting(-1); // Do not show PHP errors error_reporting(0); // Show all PHP errors error_reporting(E_ALL); // Show all PHP errors ini_set('error_reporting', E_ALL); ?> 12345678910111213 <?php// Show all PHP errorserror_reporting(-1); // Do not show PHP errorserror_reporting(0); // Show all PHP errorserror_reporting(E_ALL); // Show all PHP errorsini_set('error_reporting', E_ALL);?> Related posts: PHP header(): operation and redirect 301 with the Location header