Monday, April 25, 2011

file_get_contents: failed to open stream: Host is down

Hello, I am running php5 on my mac osx 10.5. If I write a simple php script:

<?php
file_get_contents('http://www.google.com');
?>

And run it in the command line, I get the following error:

"Warning: file_get_contents(http://www.google.com): failed to open stream: Host is down"

I'm not sure if I'm missing some setting in php.ini or something. I know if I run the same script off of my server, it executes w/o warning.

Any ideas as to what I'm missing here?

Thanks!

From stackoverflow
  • Check your firewall?

  • Firewall or you aren't connected to the internet (or maybe you are running something like LittleSnitch which is blocking Terminal.app's access).

  • Check that the PHP setting allow_url_fopen is set to On. Use phpinfo() to check all settings.

    Bart S. : That throws a different error.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.