Reputation: 28384
I'm getting close to taking a PHP application live and so I know that I need to disable error reporting (to hide errors from users) and instead log the errors.
I found the set_error_handler
function in the PHP docs and there is an example shown, but I'm wondering if there is any kind of standard error handler function (to be set as the callback in set_error_handler
) or class that is typically used by PHP developers to log errors?
If there isn't a function or class that is considered "standard," would you show your error handling function?
Upvotes: 0
Views: 270
Reputation: 12417
error_log — Send an error message to the defined error handling routines
http://php.net/manual/en/function.error-log.php
Upvotes: 1
Reputation: 1819
Your best bet would be to make changes to the php.ini file to turn on-screen error reporting off but error logging on:
ini_set("display_errors", 0);
ini_set("log_errors", 1);
ini_set("error_reporting", E_ALL &~E_DEPRECATED);
ini_set("error_log", "error.log");
Upvotes: 2