title: Long running php/fastcgi script hangs on IIS 7.5
body: <p>I have a php application running on IIS 7.5 , php 5.4 running as fastcgi. The application works absolutley fine with the exception that long running php scripts seem to hang; no 500 error they simply seem never complete and return the results to the browser.</p>
  
  <p>I've written a simple test script below to eliminate the possibility of programming error in the main app :</p>
  
  <pre><code>&lt;?php
  /* test timeout */
  /*set_time_limit(110);*/
  echo "Testing time out in seconds\n";
  for ($i = 0; $i &lt; 175; $i++) {
      echo $i." -- ";
  
      if(sleep(1)!=0)
      {
          echo "sleep failed script terminating"; 
          break;
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>If I run the script beyond 175 seconds it hangs. Below that it will return the results to the browser.</p>
  
  <p>Here are the time out parameters that I've set for php and fastcgi. I've also played around setting these really low in order to get various time out errors and have succeeded which brings me to the conclusion that there's another setting that I'm missing .. perhaps.</p>
  
  <p>Correct me if my presumptions are wrong but would it be fair to say that if a script times out the browser will get an error where as if a script is killed off by IIS before completion then nothing is returned to the browser and you get a what looks like a hang as far as the browser is concerned?</p>
  
  <p>fastcgi</p>
  
  <pre><code>activity timeout=800 Idle Timeout = 900 request Timeout 800
  </code></pre>
  
  <p>Php</p>
  
  <pre><code>max_execution_time=700
  </code></pre>