echo "end!<br>\n";
?>
---- php-7.1.0alpha2/sapi/cgi/cgi_main.c~ 2016-07-04 14:56:49.000000000 +0300
-+++ php-7.1.0alpha2/sapi/cgi/cgi_main.c 2016-07-04 14:58:17.522958766 +0300
+--- php-8.5.1/sapi/cgi/cgi_main.c.orig 2025-12-16 16:59:07.000000000 +0100
++++ php-8.5.1/sapi/cgi/cgi_main.c 2026-01-13 20:40:34.050183839 +0100
@@ -117,6 +117,9 @@ static int children = 0;
*/
static int parent = 1;
#ifndef PHP_WIN32
/* Did parent received exit signals SIG_TERM/SIG_INT/SIG_QUIT */
static volatile sig_atomic_t exit_signal = 0;
-@@ -1221,6 +1224,21 @@
+@@ -1501,6 +1504,21 @@ BOOL WINAPI fastcgi_cleanup(DWORD sig)
}
#endif
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
-@@ -1764,7 +1764,6 @@
+@@ -1733,7 +1751,6 @@ int main(int argc, char *argv[])
int requests = 0;
int fastcgi;
char *bindpath = NULL;
fcgi_request *request = NULL;
int warmup_repeats = 0;
int repeats = 1;
+@@ -2044,9 +2061,14 @@ consult the installation file that came
+ php_child_init();
+
+ /* don't catch our signals */
+- sigaction(SIGTERM, &old_term, 0);
+ sigaction(SIGQUIT, &old_quit, 0);
+ sigaction(SIGINT, &old_int, 0);
++
++ /* call graceful shutdown handler for SIGTERM */
++ act.sa_flags = 0;
++ act.sa_handler = fastcgi_graceful_shutdown;
++ sigaction(SIGTERM, &act, &old_term);
++
+ zend_signal_init();
+ break;
+ case -1: