diff options
Diffstat (limited to 'sapi/apache/mod_php4.c')
| -rw-r--r-- | sapi/apache/mod_php4.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index c7ac6cd8c3..5d05e01f52 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -284,12 +284,31 @@ static void php_apache_log_message(char *message) } +static int php_apache_sapi_activate(SLS_D) +{ + /* + * For the Apache module version, this bit of code registers a cleanup + * function that gets triggered when our request pool is destroyed. + * We need this because at any point in our code we can be interrupted + * and that may happen before we have had time to free our memory. + * The php_request_shutdown function needs to free all outstanding allocated + * memory. + */ + block_alarms(); + register_cleanup(((request_rec *) (server_context))->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec); + unblock_alarms(); +} + + static sapi_module_struct sapi_module = { "Apache", /* name */ php_apache_startup, /* startup */ php_module_shutdown_wrapper, /* shutdown */ + php_apache_sapi_activate, /* activate */ + NULL, /* deactivate */ + sapi_apache_ub_write, /* unbuffered write */ sapi_apache_flush, /* flush */ |
