title: PHP script times out in Apache but not in cli
body: <p>I have a PHP script that takes about 30 seconds to complete. When running it through php cli it finishes successfully (echos a confirmation and saves relevant results in a file on a local file system). If I run the same file through Apache, it seems to time out or something, after about 30 seconds or so, instead of the expected confirmation message, Firefox offers me to download an empty file (other browsers treat it differently, but basically, something did not go as planned). The file that was supposed to be created on the filesystem is not created.</p>
  
  <p>Knowing that the execution time could be long, I set <code>set_time_limit(400)</code> in the beginning of the script. </p>
  
  <p>Any tips on how I could debug this? What could be causing the script to time out in Apache, but not in cli?</p>