Last active
May 8, 2018 15:00
-
-
Save smartdeal/1c8afb32b196e160de52cdae0cdca9f5 to your computer and use it in GitHub Desktop.
[PHP errors to file] #PHP-hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_error_handler('err_handler'); | |
function err_handler($errno, $errmsg, $filename, $linenum) { | |
$date = date('Y-m-d H:i:s (T)'); | |
$f = fopen('errors.log', 'a'); | |
if (!empty($f)) { | |
$filename =str_replace($_SERVER['DOCUMENT_ROOT'],'',$filename); | |
$err = "$errmsg = $filename = $linenum\r\n"; | |
fwrite($f, $err); | |
fclose($f); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment