Environment:
win2008 R2 (64-bit) iis7.5 php5.5.38 (nts-vs11-x86)
php operating mode: fastcgi.
Test Code
$start = microtime(true);
set_time_limit(0); //
@ini_set("memory_limit", "-1");//
$file = "./" . time() . ".txt";
for($i = 0; $i < 350; $iPP){
echo "$i\n";
ob_flush();
flush();
sleep(1);
file_put_contents($file, $i . ":". round(microtime(true) - $start, 3)."\n", FILE_APPEND);
}
file_put_contents($file, $i . "finished\n", FILE_APPEND);
echo "finished";
problem description:
php script execution more than 300 seconds (300 seconds 320 seconds), tcp connection will be disconnected (more than 300 seconds after the execution of the "netstat-ano | findstr"ip address"" command in cmd, the connection disappears), while the php-cgi.exe is still running (you can see in the iis working process, the test code is still writing files). When the test code is finished ("finished" is written to the file), the browser is still loaded (using wireshark to grab the packet, no server is found to send response data and disconnect the handbag, and the code is normal within 300 seconds).
related configuration:
iis Application Pool:
:
fastcgi:
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters\KeepAliveTime"7200000
win2008 r2
wireshark(300):