diff --git a/main/main.c b/main/main.c index 8ab7c55067227..de674a9a91409 100644 --- a/main/main.c +++ b/main/main.c @@ -395,7 +395,15 @@ static PHP_INI_MH(OnUpdateTimeout) } zend_unset_timeout(); ZEND_ATOL(EG(timeout_seconds), ZSTR_VAL(new_value)); - zend_set_timeout(EG(timeout_seconds), 0); + if (stage != PHP_INI_STAGE_DEACTIVATE) { + /* + * If we're restoring INI values, we shouldn't reset the timer. + * Otherwise, the timer is active when PHP is idle, such as the + * the CLI web server or CGI. Running a script will re-activate + * the timeout, so it's not needed to do so at script end. + */ + zend_set_timeout(EG(timeout_seconds), 0); + } return SUCCESS; } /* }}} */