Linux – PHP file_get_contents error on CentOS

apache-2.2centoslinuxPHP

file_get_contents(http://mirror.facebook.net/centos/timestamp.txt) [function.file-get-contents]: failed to open stream: HTTP request failed!

errors on a freshly installed CentOS 5.3 box. What seems to be the problem?

[Edit]
I can get files using wget and my site can fetch RSS feeds but when I try file_get_contents() I get the error above. I don't want to change it because it's in the core of the Joomla! CMS that I'm using.

Thanks in advance 🙂

[Edit 2]
I updated PHP to 5.2.10 and it's still the same.

Best Answer

This will help you (and us) find out the problem exactly

strace php -r 'print_r(file_get_contents("http://mirror.facebook.net/centos/timestamp.txt"));'

Make sure that strace is installed and paste the output here, shouldn't be too long, and you might just see some errors yourself and find the reason of this.

If you can't locate the problem, please post the output of strace here and it'll be much easier to locate the problem.

Related Topic