tags:

views:

687

answers:

3

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!

A: 

Check your firewall?

nickf
A: 

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

gaoshan88
A: 

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

kmkaplan
That throws a different error.
Bart S.