PHP SOAP client giving “Error Fetching http headers”
Summary: PHP’s SOAP client was throwing an extremely unhelpful error: Error Fetching http headers. It turns out that it was a simple case of a slow SOAP server, and increasing the default_socket_timeout in php.ini to 120 fixed it.
Problem: My very first experience with SOAP was failing. I couldn’t figure out why one request (getVersion) worked while another (getUserList) gave the above cryptic error.
Solution: After trying in vain to get useful information out of Apache and PHP, I installed Wireshark to sniff my network traffic. I could see the response coming in just fine, but it was only when I realized that it was coming in almost 100 seconds after the request that I became suspicious. Checking my php.ini, I found that the default_socket_timeout was set to 60 seconds. I upped it to 120 and the problem was resolved.
References
- http://www.aidanfindlater.com/2008/10/23/php-soap-client-giving-error-fetching-http-headers/ »
- http://bugs.php.net/bug.php?id=37054 »
[Click to add or edit comments])
Please prepend comments below including a date