How to show errors in PHP?

If you are having problem in debugging with your PHP web application and want to display all the errors and warnings, then use error_reporting.

The quickest way to display all php errors and warnings is to add these lines to your PHP code file:

ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1); 
error_reporting(E_ALL);
  
For development server 
error_reporting should be set to E_ALL value; 
display_errors should be set to 1


For production server 
error_reporting should be set to E_ALL value; 
display_errors should be set to 0 
log_errors should be set to 1

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.