Answers

Nov 02, 2006 - 10:32 PM
I forgot to mention that I'm using PHP Version 5.1.6 on a Windows NT NS13 5.2 build 3790 machine.

Nov 03, 2006 - 04:26 AM
Well, finally it was a problem of several coinciding elements.
My host doesn't allow errorreporting directly on the page, so that was why I wasn't getting the error.
And the error was a script exceeded timeout problem, which could be solved by setting
set_time_limit($seconds);
My host doesn't allow errorreporting directly on the page, so that was why I wasn't getting the error.
And the error was a script exceeded timeout problem, which could be solved by setting
set_time_limit($seconds);

Nov 03, 2006 - 04:27 AM
I'm wondering though, how to handle fatal errors in php. Isn't there a nice way to take care of those, instead of everything breaking down? I mean at least capturing the error and showing a custom error message instead?

Nov 16, 2006 - 06:34 AM
The best way to handle errors is try not to make them.
So it would be good to add to each module a test set to discard it when problems arise.
Then there is the environment. Set a phpinfo page to check your config. parameters in the target web zone.
There are three handlers you can set, from which you can log anything you want to a file in your site with the function error_log.
With register_shutdown_function( “myOnShutdown”) you may set a function that executes at the end of request processing.
With set_error_handler( “myOnError”) you may handle the errors yourself.
With PHP5 set_exception_handler(“myOnException”) you may set an exception handler for uncaught exceptions.
There are also some network debuggers, explained at http://es2.php.net/manual/en/debugger..., but you need access to certains sockets so it is not available when app. is hosted.
So it would be good to add to each module a test set to discard it when problems arise.
Then there is the environment. Set a phpinfo page to check your config. parameters in the target web zone.
There are three handlers you can set, from which you can log anything you want to a file in your site with the function error_log.
With register_shutdown_function( “myOnShutdown”) you may set a function that executes at the end of request processing.
With set_error_handler( “myOnError”) you may handle the errors yourself.
With PHP5 set_exception_handler(“myOnException”) you may set an exception handler for uncaught exceptions.
There are also some network debuggers, explained at http://es2.php.net/manual/en/debugger..., but you need access to certains sockets so it is not available when app. is hosted.

Nov 16, 2006 - 06:58 AM
From the manual (http://es2.php.net/manual/en/function...)
>> The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
>> If errors occur before the script is executed (e.g. on file uploads) the custom error handler cannot be called since it is not registered at that time.
>> The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
>> If errors occur before the script is executed (e.g. on file uploads) the custom error handler cannot be called since it is not registered at that time.

Nov 16, 2006 - 07:09 AM
E_ALL does not include all errors (E_STRICT type is excluded).
You should write
error_reporting(E_ALL | E_STRICT)
for all errors. ( see note at http://es2.php.net/manual/en/function...).
You should write
error_reporting(E_ALL | E_STRICT)
for all errors. ( see note at http://es2.php.net/manual/en/function...).

Nov 16, 2006 - 08:08 AM
that's great info there, xarcus.
I think set_exception_handler(“myOnException”) is what I was looking for.
Thanks a lot.
I think set_exception_handler(“myOnException”) is what I was looking for.
Thanks a lot.
Add New Comment