Bug #27150
closedPHP errors not logged to webserver's error_log
0%
Description
I had a very interesting problem today: the BE login was impossible on a fresh Typo3 installation (4.5.2, but that doesn't really matter).
It turned out that someone changed the directory permission on the session.save_path directory, making it impossible to store the session. Normally (as in "some non-Typo3 PHP script") that results in an entry in the webserver's error log, which makes it quite easy to find the problem.
The problem: the PHP error message was only logged to the sys_log table, which is readable with the log module in the backend - IF you can login...
It would be a very good idea to log PHP errors to the webserver's error log, not (only) into a somehow hidden log table. The average server admin checks the error log and might not even be aware of the sys_log table.
A comment from Johan "Josso" Jensen on
http://de2.php.net/manual/de/function.set-error-handler.php
says that you should use error_log() inside the error handler:
if (ini_get('log_errors')) error_log(sprintf("PHP %s: %s in %s on line %d", $errors, $errstr, $errfile, $errline));
Note: I did not test this. The information about using error_log is just copy&paste from the php.net page ;-)