Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught SoapFault exception: [HTTP] Error Fetching http headers

Try to set :

default_socket_timeout = 120

in your php.ini file.


Did you try adding

'trace'=>1,

to SoapClient creation parameters and then:

var_dump($client->__getLastRequest());
var_dump($client->__getLastResponse());

to see what is going on?


This error can appear on the client if there is a problem on the server side. For example, if the SOAP server is a PHP script with a parse error, the client will fail with this message.

If you are in control of the server, tail your Apache error_log on the machine that hosts the SOAP server. On CentOS you will find this in /var/log/httpd/error_log, so the command is:

tail -f /var/log/httpd/error_log

Now refresh the client and watch for the error message. Any PHP errors with the server script will be shown.

Hope that helps someone.


I faced the same problem.
I was running It as CLI. So PHP was always running and it had to make soap call again and again after some interval.
The mistake I did was using singleton pattern for this. I thought use of singleton will cause performance boost but inturn I got

Error Fetching http headers in ...

I fixed it by creating new saop object for each call.


I am not about your PHP configuration but until PHP 5.2.6 , PHP does have some problem with SOAP client :

Bug #41983 - Error Fetching http headers

Bug #41983


If this is a Magento related problem, you should turn off automatic re-indexing as this could be causing the socket to timeout (or expire). You can turn it back on once the script has finished its tasks. Increasing the default socket timeout in php.ini is also a good idea.