From: Rasmus Lerdorf Date: Fri, 3 Dec 1999 05:03:16 +0000 (+0000) Subject: @ PHP 4 scripts will now obey the max_execution_time setting and actually X-Git-Tag: PRE_RETURN_REF_PATCH~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=162adb778e7670050f7275971b5da174209c2100;p=php @ PHP 4 scripts will now obey the max_execution_time setting and actually @ time out (Rasmus) # Note that Apache clears all signal handler including SIGPROF before # calling the content handler, so even though we set our itimer before # this in the PHP_INI stuff, Apache kicks sand in our face and we need # to set the timer again just before we start parsing --- diff --git a/main/main.c b/main/main.c index 367c92ae8a..4ea14444c5 100644 --- a/main/main.c +++ b/main/main.c @@ -129,12 +129,14 @@ static PHP_INI_MH(OnSetPrecision) static PHP_INI_MH(OnChangeMaxExecutionTime) { int new_timeout; + PLS_FETCH(); if (new_value) { new_timeout = atoi(new_value); } else { new_timeout = 0; } + PG(max_execution_time) = new_timeout; php_set_timeout(new_timeout); return SUCCESS; } @@ -740,6 +742,8 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) zend_activate(CLS_C ELS_CC); sapi_activate(SLS_C); + php_set_timeout(PG(max_execution_time)); + if (PG(output_buffering)) { php_start_ob_buffering(); } diff --git a/main/php_globals.h b/main/php_globals.h index 44c8cbbf05..b11f8a7816 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -89,6 +89,8 @@ struct _php_core_globals { short connection_status; short ignore_user_abort; + long max_execution_time; + unsigned char header_is_being_sent; zend_llist ll_post_request_startup;