note 95206 modified in function.set-error-handler by danbrown
| From: | danbrown@php.net | Date: | Fri, 18 Dec 2009 15:40:30 +0000 |
| Subject: | note 95206 modified in function.set-error-handler by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164107@lists.php.net to get a copy of this message | ||
This may be of help to someone, who is/was looking for a way to get a backtrace of fatal errors such
as maximum memory allocation issues, which can not be handled with user-defined functions, to
pin-point the problem:
On a server hosting many sites that share common PHP includes, I set in one spot:
<?php
@ini_set ("error_log", "/my/path/php.err-" . $_SERVER ["HTTP_HOST"] .
"-" . $_SERVER ["REMOTE_ADDR"] . "-" . $_SERVER
["REQUEST_METHOD"] . "-" . str_replace ("/", "|", $_SERVER
["REQUEST_URI"]));
?>
I actually used some additional information too from my software that I omitted, but that way,
you'll find errors sorted more neatly in for example:-
/my/path/php.err-website.com-127.0.0.1-GET-path|index.html?xyz
And that at least helped me tremendously to then further pin-point where the problem is, as opposed
to before just seeing the out of memory and not knowing which site/page it was on (as the PHP error
only contains the very latest PHP code where it ran out of memory, which usually is just a shared
included file, not the actual page).
--was--
This may be of help to someone, who is/was looking for a way to get a backtrace of fatal errors such
as maximum memory allocation issues, which can not be handled with user-defined functions, to
pin-point the problem:
On a server hosting many sites that share common PHP includes, I set in one spot:
@ini_set ("error_log", "/my/path/php.err-" . $_SERVER ["HTTP_HOST"] .
"-" . $_SERVER ["REMOTE_ADDR"] . "-" . $_SERVER
["REQUEST_METHOD"] . "-" . str_replace ("/", "|", $_SERVER
["REQUEST_URI"]));
I actually used some additional information too from my software that I omitted, but that way,
you'll find errors sorted more neatly in for example:-
/my/path/php.err-website.com-127.0.0.1-GET-path|index.html?xyz
And that at least helped me tremendously to then further pin-point where the problem is, as opposed
to before just seeing the out of memory and not knowing which site/page it was on (as the PHP error
only contains the very latest PHP code where it ran out of memory, which usually is just a shared
included file, not the actual page).
http://php.net/manual/en/function.set-error-handler.php