停用 PHP 错误记录
Deactivating PHP error logging
我刚刚注意到我在 XAMPP 中遇到的所有 PHP 错误都存储在一个日志中,该日志的大小已经达到 500 MB。我现在想停用日志记录,而不是在执行时实际停止报告。我怎样才能做到这一点?
在您的 php 文件的顶部
ini_set('log_errors', 'off');
或在您的 PHP.ini:
log_errors = off
<?php
// Turn off all error reporting
error_reporting(0);
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors
error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
我刚刚注意到我在 XAMPP 中遇到的所有 PHP 错误都存储在一个日志中,该日志的大小已经达到 500 MB。我现在想停用日志记录,而不是在执行时实际停止报告。我怎样才能做到这一点?
在您的 php 文件的顶部
ini_set('log_errors', 'off');
或在您的 PHP.ini:
log_errors = off
<?php
// Turn off all error reporting
error_reporting(0);
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors
error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>