Display PHP Errors

PHP Error Display Setting: 

If we need to be experienced developer, it’s very important to work with errors and working.
This always helps us to write errors less code. 

Then it’s very important to write proper error handing code, but I always prefer error handing code on live environment and not on development or test environment.

Sometime error are displaying in PHP this could be due to you have implementing error suppress code or another silly reason that we are looking in other function.

Use below code that will help to show the error on your PHP code or file.

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

The above code will display error on your PHP file. In case error are still not displaying , you have to check the php.ini configuration . You have to check PHP file configuration.
Make below change to reflate error on page.

File Name: php.ini
Change needed:  display_errors = on


In case you are still facing issue with this code , please make a comment and add your any suggestions.

1 comment :

Post a Comment

Leave A Comment...