There are some workarounds with register_shutdown_function to extend E_ERROR messages, but I think that's quite dirty in a system with many parallel requests. Here is an example:
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 0); ini_set('log_errors', 1); ini_set('error_log', 'php_error.log'); ini_set('date.timezone', 'Europe/Berlin'); ini_set('memory_limit', '16M'); $_SERVER['HTTP_HOST'] = 'mywebsite.com'; $_SERVER['REQUEST_URI'] = '/custom/foobar'; $_REQUEST = array('action' => 'edit'); function check_for_fatal() { $error = error_get_last(); if ($error['type'] == E_ERROR) { $errstr = ''; if (!empty($_SERVER['REQUEST_URI'])) { $errstr .= ' Request-Uri: '.$_SERVER['REQUEST_URI'].PHP_EOL; } $errstr .= ' Request-Params: '.json_encode($_REQUEST); file_put_contents('php_error.log', $errstr. PHP_EOL, FILE_APPEND); } } register_shutdown_function('check_for_fatal'); $str = str_repeat('##########', 2*1024*1024); gives: [28-Jan-2015 07:00:53 Europe/Berlin] PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 20971521 bytes) in test.php on line 27 Request-Uri: /custom/foobar Request-Params: {"action":"edit"} Regards Thomas Xinchen Hui wrote on 27.01.2015 13:26: > Hey: > > On Tue, Jan 27, 2015 at 11:08 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: >> Hi Thomas, >> >> On Tue, Jan 27, 2015 at 11:45 AM, Thomas Bley <ma...@thomasbley.de> wrote: >> >>> Here is the rfc: >>> >>> https://wiki.php.net/rfc/error_handler_callback_parameters_passed_by_reference >>> >>> Thanks to reeze for coding and putting it on the wiki. >>> >> >> It looks good to me. >> >> Future Scope >> set_error_handler() callback might be able to handle E_ERROR to be able to >> append additional information to memory_limit exhaustions (or others). >> >> I really want to catch E_RROR by user defined error handler. The only >> reason why this was disabled is abuse of error handler. We may document >> abuse of error handler with E_ERROR may result in undefined behavior >> including memory leak/crash and allow it. > I feel it's kindof wrong direction. > > if you want custom logs, maybe you should use custom logger. > > thanks >> >> Regards, >> >> -- >> Yasuo Ohgaki >> yohg...@ohgaki.net > > > > -- > Xinchen Hui > @Laruence > http://www.laruence.com/ > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php