Error output in PHP

-, . . PHP.

?

PHP . — , — . .

php error output




, PHP . , , .

PHP php.ini. error_reporting, PHP. , , display_errors. , .

PHP :

  • , . , . E_ERROR, E_COMPILE_ERROR;





  • , . error_reporting : E_WARNING, E_NOTICE .

.

  • E_ERROR. , . ;

  • E_WARNING. , , - , . ;

  • E_NOTICE. , : , . ;

  • E_USER_ERROR. , ;

  • E_ALL. . , .

PHP

PHP , — . , , — php.ini. — display_errors error_reporting :

display_errors on

error_reporting E_ALL

.

php enable error output




, . Apache htaccess. . :





php_flag display_errors on

php_value error reporting -1

, ini_set(). , .

php file error output




PHP . PHP , :

  1. php.ini. . — log_errors = On, , . — error_log = / /.

  2. htaccess. . php_value log_errors «on» php_value error_log / .

  3. ini_set.

Error output in PHP is a necessary tool for debugging code. But it can also create potentially vulnerable areas. Therefore, you need to use this mechanism carefully and carefully. After the site or service has passed all stages of testing, you need to make sure that it does not display errors, with which the attacker can gain access to important data.




All Articles