Results 1 to 1 of 1
After a year or so a problem which I am having with one of the servers I am administering is beginning to develop into pure frustration I have tried to ...
- 02-23-2010 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 6
Apache unable to access external resources - no route to host
After a year or so a problem which I am having with one of the servers I am administering is beginning to develop into pure frustration
I have tried to address the problem over a year ago but since in the meantime I was busy I got to it back a couple of days ago. Honestly I have run out of ideas so any suggestion, no matter how insignificant and irrelevant it might seem, would be appreciated.
First of all I have attached a picture which generally explains what is the problem. Namely, I am running Apache on CentOS 5.4 which also serves as a gateway for a couple of computers in a local network. All is working fine and the computers inside the local network have access to internet and the web server.
The issue is that on the web server there are a couple of PHP applications (forums and some custom made) that require Apache to fetch some pages from the external resources i.e. web pages etc. but when that happens Apache is simply not able to fetch them. It throws a message like this
I first thought that because we have to use a proxy server to gain access to the "outer" world the solution would be simple as in adding an environmental variable http_proxy to all accounts through /etc/profiles. That resolved the problem of accessing the internet from the shell (i.e. wget through proxy, curl, yum update etc.) but Apache still played dumb. I was even able to run the php page through shell with php executable and there were no problems but when I try to execute the same code through Apache it fails with the above error.Code:Warning: file_get_contents(http : // somedomain DOT com) [function.file-get-contents]: failed to open stream: No route to host in /home/theta5/public_html/fetchl.php on line 11
After that I thought that perhaps apache user somehow didn't have access to that environmental variable so I granted it a full login account (switched from /sbin/nologin to /bin/bash) and checked to see if it can access the variable (env | grep proxy) and it was there but Apache still refuses to fetch external pages. Oh yes...Somehow if I try to fetch the web page that lies on the web server itself (I use the physical address of the server) Apache is able to fetch it
Now who is dumb here?
I tried everything I could think of, I literally crawled hundreds of pages for a solution and I can't seem to find one. By narrowing the possible causes I have found out that Apache is simply unable to resolve the address before it actually sends a request.
Once again I am thankful for any kind of suggestion since this is really really going to send me into retirement if I don't fix it soon


Reply With Quote
