title: php soap error fetching http headers
body: <p>I am working on a PHP script that's processing a lot of data through a SOAP connection. Estimates of the total run time of the script look to be several days if it doesn't encounter any errors. The problem I'm running into is the script will run for a while, anywhere from an hour to a day, and then the SOAP connection will die with the error <code>"error fetching http headers"</code>. </p>
  
  <p>I've seen many articles suggesting increasing the <strong>default_socket_timeout</strong> setting and I've tried this. It hasn't helped. I know it's working cause it makes at least a hundred successful calls before it fails. Is there anything i can do to stop this error?</p>
  
  <p><strong>Update</strong><br>
  I printed out the request and response headers hoping to see an error in there. But it appears they are fine:</p>
  
  <blockquote>
    <p>HTTP/1.1 200 OK<br>
    Date: Wed, 25 Sep 2013 21:00:12 GMT<br>
    Server: Apache/2.2.15 (CentOS)<br>
    X-Powered-By: PHP/5.3.3<br>
    Content-Length: 516<br>
    Connection: close<br>
    Content-Type: text/xml; charset=UTF-8</p>
  </blockquote>
  
  <p>as far as example code goes the actual script is crazy long, but the basic premise is this:</p>
  
  <pre><code>ini_set('default_socket_timeout', 120);
  $client = new SoapClient($wsdl,array(
      'trace' =&gt;true,
      'connection_timeout' =&gt; 500000,
      'cache_wsdl' =&gt; WSDL_CACHE_BOTH,
      'keep_alive' =&gt; true,
  ));
  while(!$finished) {
      $finished = $client-&gt;someSoapFunction($data);
  }
  </code></pre>
  
  <p><code>someSoapFunction()</code> will return valid data for 100 of connections and then randomly return me the above error. The time it runs for is less than either of the set timeouts. I'm getting no errors in my php or apache error logs. I'm stumped.</p>