3 http://bugs.php.net/bug.php?id=43224 this patch
5 http://bugs.php.net/bug.php?id=41593
6 http://bugs.php.net/bug.php?id=36158
7 http://php-fpm.anight.org/
11 echo php_sapi_name(), ' running ', PHP_VERSION, "<br>\n";
14 echo (++$i), "<br>\n";
21 --- php-7.1.0alpha2/sapi/cgi/cgi_main.c~ 2016-07-04 14:56:49.000000000 +0300
22 +++ php-7.1.0alpha2/sapi/cgi/cgi_main.c 2016-07-04 14:58:17.522958766 +0300
25 static int parent = 1;
27 +/* Socket we are listening on incoming connections */
28 +static int fcgi_fd = 0;
31 /* Did parent received exit signals SIG_TERM/SIG_INT/SIG_QUIT */
32 static int exit_signal = 0;
33 @@ -1221,6 +1224,21 @@
38 + * Graceful shutdown. Close listening sockets.
40 +void fastcgi_graceful_shutdown(int signal)
43 + fprintf(stderr, "FastCGI graceful shutdown, pid %d\n", getpid());
46 + /* Close the listening socket so new processes can reuse the same port */
47 + closesocket(fcgi_fd);
53 STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
54 STD_PHP_INI_ENTRY("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
58 char *bindpath = NULL;
60 fcgi_request *request = NULL;
61 int warmup_repeats = 0;
63 @@ -2080,9 +2080,14 @@
66 /* don't catch our signals */
67 - sigaction(SIGTERM, &old_term, 0);
68 sigaction(SIGQUIT, &old_quit, 0);
69 sigaction(SIGINT, &old_int, 0);
71 + /* call graceful shutdown handler for SIGTERM */
73 + act.sa_handler = fastcgi_graceful_shutdown;
74 + sigaction(SIGTERM, &act, &old_term);