- Joined
- Jul 11, 2008
- Posts
- 4,542
- Reaction score
- 202
I've run into a slight problem, and wondered if anyone here had any suggestions or idea's.
I use register_shutdown_function() to catch unexpected errors and perform house cleaning (deleting temp files, unlocking databases, etc) but I'm having problems catching a 500 error.
When the script times out, I want to perform house cleaning, but as yet nothing seems to work, an option would be to create a 500.php file so when it served it could check the referer then perform defined housecleaning but this would mean maintaining a 500 catch/clean system.
Does anyone know if you can actually catch a 500 error ?
My code is as simple as
I assume from within the shutdown function, I can access the resources from the main script ?
I use register_shutdown_function() to catch unexpected errors and perform house cleaning (deleting temp files, unlocking databases, etc) but I'm having problems catching a 500 error.
When the script times out, I want to perform house cleaning, but as yet nothing seems to work, an option would be to create a 500.php file so when it served it could check the referer then perform defined housecleaning but this would mean maintaining a 500 catch/clean system.
Does anyone know if you can actually catch a 500 error ?
My code is as simple as
PHP:
register_shutdown_function( "house_cleaning" );
function house_cleaning() {
// perform required tasks
// possibly restart process if incomplete
}
I assume from within the shutdown function, I can access the resources from the main script ?
Last edited: