Menu

Add Topic

programming

waiting answer July 28, 2021

PHP display errors

Answers
June 07, 2021

Add the following line of code to your top of PHP code

    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
  • The function ini_set will try to override the configuration found in the PHP ini file
  • The display_errors is a directive that determines whether the error will remain hidden and displayed to the user.
  • display_startup_errors is a directive that is used to find errors during PHP’s startup sequence.
0 0
June 07, 2021

Display PHP Error using .htaccess

    php_flag display_errors on
    php_flag display_startup_errors on
    php_flag log_errors on
    php_flag html_errors on
    php_value error_log  /path/PHP_errors.log
0 0
June 07, 2021

Following are the types of errors in a PHP code

  • E_ERROR
  • E_PARSE
  • E_NOTICE
  • E_CORE_ERROR
  • E_ALL

To report all errors

     error_reporting(E_ALL);

OR

     ini_set("error_reporting", E_ALL); //It is also same as E_ALL

To Report all errors except E_NOTICE

     error_reporting(E_ALL & ~E_NOTICE);
0 0
June 07, 2021

PHP Provides different ways to display errors and warnings

  1. error_reporting
  2. display_errors
  3. log_errors
  4. error_log string

error_reporting

It displays all types of errors except E-NOTICE, E_DEPRECATED, and E-STRICT.

display_errors

By default, the value of display errors is off. Set it on to display all errors including syntax errors.

log_errors

By default, the value of log_errors is ON. It indicates the error logging should be done or not.

0 0

Please Login to Post the answer

Leave an Answer