I am trying to achieve the following for my site; first of all, this is for production mode only. My goal is to keep all errors hidden from the visitor, but log them and display a 500 Internal Server Error Page.
The part of hiding those errors is easy - the only thing is to turn off display_errors.
Right now, I am using a custom written function as error handler. It basically just sends a 500 Error Page, but neither that seems to work. Here is the function:
function error_handler($errno, $errstr) { header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); die(); }
Because of this, another error occurs - the errors don't get logged because I use die() at the end of this function.
Any idea how this might work?
看看error_log函数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.