LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   file_get_contents errors on CentOS 5.3 (https://www.linuxquestions.org/questions/linux-server-73/file_get_contents-errors-on-centos-5-3-a-735750/)

anwar 06-26-2009 03:08 AM

file_get_contents errors on CentOS 5.3
 
Hi, I got a freshly installed CentOS 5.3 box and I'm getting this error:

Code:

file_get_contents(http://www.google.com) [function.file-get-contents]: failed to open stream: HTTP request failed!
Do you guys have any idea what's causing this?

pazzport 06-26-2009 10:51 PM

1. I'm guessing you've tried the basics, i.e. you have a working network connection and you can ping www.google.com?

2. Where are you seeing this error? Is this in a log somewhere or in your browser? Can you post more details on your question. Thanks.

sleddog 06-27-2009 08:26 PM

Assuming you mean the PHP function file_get_contents(), you need to check your php.ini configuration for:

allow_url_fopen = On
allow_url_include = On

If they're set to "Off", change them. And after you make the change(s) restart Apache.

anwar 06-28-2009 10:05 PM

pazzport: yes i tried them. I tried wget-ting the file and I can get the file. Here's the error when I try it on the command line:

Code:

# php -r 'print_r(file_get_contents("http://mirror.facebook.net/centos/timestamp.txt"));'
PHP Warning:  file_get_contents(http://mirror.facebook.net/centos/timestamp.txt): failed to open stream: HTTP request failed!  in Command line code on line 1

sleddog: I followed your sintructions and it's still the same.


All times are GMT -5. The time now is 06:57 AM.