Forum Moderators: coopster
I have a strange problem that is really annoying me!
Take test.php
<?
$data = file_get_contents("http://example.com/example.html");
echo $data;
?>
Goto [localhost...] in a web browser and nothing at all happens! Blank Page...
Goto the command line and type "php ./test.php" and theres the contents of example.html
OK maybe this is to do with permissions so lets see who the php scripts are running as
<?
$output=shell_exec("whoami");
echo $output;
?>
It gives "apache apache"
Lets look up the user id of apache type "cat /etc/passwd"
ok apache has the user id of 48
chown 48 ./test.php
why not chmod 777 ./test.php for the hell of it
Goto [localhost...] in a web browser and nothing at all happens again! Blank Page...
Any Ideas!?!
I did the exact same with a test.pl to do the same and it worked from command line but not from a web browser
Is it possible that you have a firewall blocking web-based requests for external files (like my host does), but allowing ones from the command line? (I'm no server expert so don't laugh if I'm way off the mark! ;) )