@@ -2018,6 +2018,22 @@ consult the installation file that came with this distribution, or visit \n\
2018
2018
/* This is the number of concurrent requests, equals FCGI_MAX_CONNS */
2019
2019
fcgi_set_mgmt_var ("FCGI_MAX_REQS" , sizeof ("FCGI_MAX_REQS" )- 1 , children_str , strlen (children_str ));
2020
2020
} else {
2021
+ #ifdef PHP_WIN32
2022
+ /* If this env var is set, the process was invoked as a child. Let
2023
+ it show the original PHP_FCGI_CHILDREN value, while don't care
2024
+ otherwise. */
2025
+ char * children_str = getenv ("PHP_FCGI_CHILDREN_FOR_KID" );
2026
+ if (children_str ) {
2027
+ char putenv_buf [sizeof ("PHP_FCGI_CHILDREN" )+ 5 ];
2028
+
2029
+ snprintf (putenv_buf , sizeof (putenv_buf ), "%s=%s" , "PHP_FCGI_CHILDREN" , children_str );
2030
+ putenv (putenv_buf );
2031
+ putenv ("PHP_FCGI_CHILDREN_FOR_KID=" );
2032
+
2033
+ SetEnvironmentVariable ("PHP_FCGI_CHILDREN" , children_str );
2034
+ SetEnvironmentVariable ("PHP_FCGI_CHILDREN_FOR_KID" , NULL );
2035
+ }
2036
+ #endif
2021
2037
fcgi_set_mgmt_var ("FCGI_MAX_CONNS" , sizeof ("FCGI_MAX_CONNS" )- 1 , "1" , sizeof ("1" )- 1 );
2022
2038
fcgi_set_mgmt_var ("FCGI_MAX_REQS" , sizeof ("FCGI_MAX_REQS" )- 1 , "1" , sizeof ("1" )- 1 );
2023
2039
}
@@ -2124,6 +2140,10 @@ consult the installation file that came with this distribution, or visit \n\
2124
2140
2125
2141
/* kids will inherit the env, don't let them spawn */
2126
2142
SetEnvironmentVariable ("PHP_FCGI_CHILDREN" , NULL );
2143
+ /* instead, set a temporary env var, so then the child can read and
2144
+ show the actual setting correctly. */
2145
+ snprintf (kid_buf , 16 , "%d" , children );
2146
+ SetEnvironmentVariable ("PHP_FCGI_CHILDREN_FOR_KID" , kid_buf );
2127
2147
2128
2148
/* The current command line is used as is. This should normally be no issue,
2129
2149
even if there were some I/O redirection. If some issues turn out, an
@@ -2216,7 +2236,6 @@ consult the installation file that came with this distribution, or visit \n\
2216
2236
WaitForMultipleObjects (kids , kid_cgi_ps , FALSE, INFINITE );
2217
2237
}
2218
2238
2219
- snprintf (kid_buf , 16 , "%d" , children );
2220
2239
/* restore my env */
2221
2240
SetEnvironmentVariable ("PHP_FCGI_CHILDREN" , kid_buf );
2222
2241
0 commit comments