Question

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!

Was it helpful?

Solution

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

OTHER TIPS

Check your firewall?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top