PHP file_get_contents error on CentOS

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.


My first reaction is that this is most likely SELinux that's keeping your PHP scripts from making an outbound network connection. This is enabled by default to help increase security. You can typically enable this functionality by typing

setsebool -P httpd_can_network_connect 1