Web Hosting Talk







View Full Version : [PHP]: Permission denied ?


abdoh2010
04-29-2005, 07:49 PM
i'm trying to extact the file "/tmp/webalizer/index.html" to the public by php code


$handle = fopen("/home/site/tmp/webalizer/index.html", "r");
echo $handle ;
fclose($handle);


but it dont work
it gave me

Warning: fopen(/home/site/tmp/webalizer/index.html): failed to open stream: Permission denied in /home/racing4e/public_html/bandwdith.php on line 2

Warning: fclose(): supplied argument is not a valid stream resource in /home/site/public_html/bandwdith.php on line 4


so i tryed to change it from 644 to 666 to 755 but nochange is happen

any one know whats wrong here ?

absolut
04-30-2005, 02:44 PM
It seems like php work in safe mode and the owner of "index.html" file differ from user that execute your script. Usually it is apache or nobody. So you should turn safe mode off.

Pc-Center.gr
04-30-2005, 03:40 PM
why dont you do this via shell:

cd ~ ; cd www
ln -s /home/site/tmp/webalizer/index.html ./band.html

and then you can access it from:
http://domain/band.html

so:
$a = include('http://domain/band.html');
echo $a;

would work fine

abdoh2010
04-30-2005, 10:48 PM
nise
i'm trying to do this to select the bandwidth line and show it out to the vistor by echo or what ever
i search about php code do this job but i didnt find one
so i'm trying to do it by my self
just trying

the file is in the tmp dir
in anather word it's out of public_html
and for my that's the deficalt part
how to fetch a file out of the public_html to the main page of my website

Pc-Center.gr
05-01-2005, 05:26 PM
did you tried what i told you ?
didnt worked ??

hrm
05-03-2005, 05:48 AM
Seems 'apache' user have no permissions to read this file.
try to add read permissions in console with
% chmod 655 /home/site/tmp/webalizer/index.html

Also I'm not sure that
echo $handle;
would work.. you should read file with fread() function..