Page 1 of 1
[solved] failed to open stream: Permission denied
Posted: Sun Jul 17, 2005 10:59 am
by gorgor
I am trying to use the file command to open a remote file via http.
As a test I am just trying to hit google for now.
I get the following error.
Warning: file(
http://www.google.ca) [function.file]: failed to open stream: Permission denied in /var/www/html/new.php on line 3
I can use file to open local files just file.
phpinfo.php shows allow_url_fopen=On
safe mode is off.
Not sure why it cant open the url.
Posted: Sun Jul 17, 2005 11:34 am
by Chris Corbyn
Are you definitely using file() and not fopen()?
If you're using fopen() the only mode that will work is 'r'.
Perhaps file_get_contents() is what you're looking for?
Posted: Sun Jul 17, 2005 11:41 am
by gorgor
Thanks for the reply,
I am going:
$lines = file("
http://www.google.ca");
Posted: Sun Jul 17, 2005 12:37 pm
by Chris Corbyn
Hmm... I can't see a reason for that then. Try adding the trailing forward slash because without it there's no path in the HTTP GET request and if that fails are you behind a proxy or firewall?
Posted: Sun Jul 17, 2005 12:42 pm
by gorgor
Good ideas,
trailing slash didn't help it.
box is behind a firewall but I can lynx out to the web from it no prob.
I suspect some apache security thing, its a fresh install of FC4 with the SELinux enhancement...
Posted: Sun Jul 17, 2005 12:43 pm
by Chris Corbyn
Does your firewall require authentication?
Posted: Sun Jul 17, 2005 12:46 pm
by gorgor
No, the firewall really only does incoming filtering.
[solved]
Posted: Sun Jul 17, 2005 1:19 pm
by gorgor
Yay!
It seems it was something to do with selinux.
I changed:
/etc/selinux/config
SELINUX=disabled
now it works fine, i will look into finer control of this selinux as it looks like you can shut it off for httpd.