title: PHP mail() timeout
body: <p>First a few infos:</p>
  
  <ul>
  <li>Debian Squeeze</li>
  <li>PHP 5.3.3</li>
  <li>PHP with mod_cgi</li>
  <li>I absolutely HAVE to use <code>mail()</code> in this case. For all my other projects I already use SMTP mailing.</li>
  </ul>
  
  <p>I have isolated the problem of a site timeout to the PHP <code>mail()</code> function. This is the only line of code in a test.php file on my server:</p>
  
  <pre><code>&lt;?php mail('rudolf@geardev.de', 'test', 'test');
  </code></pre>
  
  <p>Which seems to take endless and is then terminated by mod_cgi after 40 seconds. The command</p>
  
  <pre><code>php -r "mail('rudolf@geardev.de', 'test', 'test');"
  </code></pre>
  
  <p>on the command line sends the email instantly.</p>
  
  <p>Please tell me which log files you want to see, the Apache log is this:</p>
  
  <pre><code>[Thu Jan 17 12:17:00 2013] [warn] [client 178.15.148.43] mod_fcgid: read data timeout in 40 seconds
  [Thu Jan 17 12:17:00 2013] [error] [client 178.15.148.43] Premature end of script headers: test.php
  </code></pre>
  
  <p>I think the problem is that I accidentally ran <code>chmod -R 775</code> on the root directory a few days ago. I fixed all errors already, besides this one.</p>