title: Why do I need to explicitly output the HTTP header for IIS but not Apache?
body: <p>I am trying to set up apache instead of IIS because <a href="https://stackoverflow.com/questions/188896/why-does-iis-crash-when-i-print-to-stderr-in-perl">IIS needlessly crashes</a> all the time, and it would be nice to be able to have my own checkout of the source instead of all of us editing a common checkout.</p>
  
  <p>In IIS we <em>must</em> do something like this at the beginning of each file:</p>
  
  <pre><code>use CGI;
  my $input = new CGI();
  print "HTTP/1.0 200 OK";
  print $input-&gt;header();
  </code></pre>
  
  <p>whereas with apache we <em>must</em> leave off the 200 OK line.  The following works with both:</p>
  
  <pre><code>use CGI;
  my $input = new CGI();
  print $input-&gt;header('text/html','200 OK');
  </code></pre>
  
  <p>Can anyone explain why?  And I was under the impression that the CGI module was supposed to figure out these kind of details automatically...</p>
  
  <p>Thanks!</p>
  
  <p><strong>Update</strong>:  brian is right, nph fixes the problem for IIS, but it is still broken for Apache.  I don't think it's worth it to have conditionals all over the code so I will just stick with the last method, which works with and without nph.</p>