Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2004
    Ypsilanti, Michigan

    [PHP]: Permission denied ?

    i'm trying to extact the file "/tmp/webalizer/index.html" to the public by php code

    PHP Code:
    $handle fopen("/home/site/tmp/webalizer/index.html""r");
    $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 ?

  2. #2
    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.

  3. #3
    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:

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

    would work fine

  4. #4
    Join Date
    Oct 2004
    Ypsilanti, Michigan
    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

  5. #5
    did you tried what i told you ?
    didnt worked ??

  6. #6
    Join Date
    May 2005
    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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts