We have (in development) two websites running RHEL4/Apache/PHP 5/Postgres 8. They are on the same server, mapped via the apache config file, and have domain names siteA.ourdomain.com and siteB.ourdomain.com. One of the service calls to siteA.ourdomain.com loads XML from a service call to siteB.ourdomain.com. This happens with the line:
This service call fails INTERMITTENTLY at the call to DOMDocument::load(). It happens roughly every 3rd try. The requests waits for about 30 seconds and then fails with this warning:
) [<a href='function.DOMDocument
ad</a>]: failed to open stream: Connection timed out in [path] on line [line]
Here's what we've already tried, in terms of debugging:
- Confirmed that the PHP directive allow_url_fopen is on in php.ini.
- Confirmed that you can traceroute to and ping "siteB.ourdomain.com" from the server, so the name is resolving.
- Confirmed that you can run this command directly on the server, so it's not the fopen access:
php -r "fopen('http://siteB.ourdomain.com/flash.php?f=getQuestion&questionId=1'
Strangely, if we move the website at siteA.ourdomain.com from that server to my local machine, it works fine. It loads data from siteB.ourdomain.com every time. Could there be a problem opening one HTTP connection within another HTTP connection on the same server?