summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-16 02:27:47 +0000
committerZeev Suraski <zeev@php.net>2000-06-16 02:27:47 +0000
commitc885f468aa110c685890f0c249eb20c47de693a3 (patch)
tree84ec0cfafae93a0097ac9e679535505bcfdefeec
parent090d39b7b12571c8cbd14cb631bf0b0b2609f856 (diff)
downloadphp-git-c885f468aa110c685890f0c249eb20c47de693a3.tar.gz
Improve timeout support - ini_get("max_execution_time", ...) works now
-rw-r--r--main/main.c21
-rw-r--r--main/php_globals.h2
2 files changed, 18 insertions, 5 deletions
diff --git a/main/main.c b/main/main.c
index 6da4b219b5..435d42afef 100644
--- a/main/main.c
+++ b/main/main.c
@@ -160,6 +160,21 @@ static PHP_INI_MH(OnDisableFunctions)
}
+static PHP_INI_MH(OnUpdateTimeout)
+{
+ ELS_FETCH();
+
+ EG(timeout_seconds) = atoi(new_value);
+ if (stage==PHP_INI_STAGE_STARTUP) {
+ /* Don't set a timeout on startup, only per-request */
+ return SUCCESS;
+ }
+ zend_unset_timeout();
+ zend_set_timeout(EG(timeout_seconds));
+ return SUCCESS;
+}
+
+
/* Need to convert to strings and make use of:
* DEFAULT_SHORT_OPEN_TAG
* PHP_SAFE_MODE
@@ -227,7 +242,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateInt, max_execution_time, php_core_globals, core_globals)
+ PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout)
STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, upload_max_filesize, php_core_globals, core_globals)
@@ -602,9 +617,9 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
#ifdef VIRTUAL_DIR
virtual_cwd_activate(SG(request_info).path_translated);
#endif
-
- zend_set_timeout(PG(max_execution_time));
+ zend_set_timeout(EG(timeout_seconds));
+
if (PG(expose_php)) {
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
}
diff --git a/main/php_globals.h b/main/php_globals.h
index 7c5a0fb919..aba2b966bb 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -97,8 +97,6 @@ struct _php_core_globals {
short connection_status;
short ignore_user_abort;
- long max_execution_time;
-
unsigned char header_is_being_sent;
zend_llist tick_functions;