How to access root directory? What is the correct path?

Discussion in 'PHP' started by aayybb, Jun 15, 2009.

  1. #1
    There are files in the /var/www/vhosts/domain.com/statistics/logs which I would like to read.

    If you use FTP to look at it, /statistics and /httpdocs are at the same level.

    How do I access the files in the /statistics if I have a program www.domain.com/testing.php to list the files at the /statistics/logs?

    What will be the correct path?

    Thanks for any help in advance.
     
    aayybb, Jun 15, 2009 IP
  2. webhed21

    webhed21 Member

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Most hosts have slightly different setups, you should contact your web host provider and ask them directly for accurate information pertaining to your servers setup
     
    webhed21, Jun 15, 2009 IP
  3. webwurks

    webwurks Well-Known Member

    Messages:
    126
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #3
    /var/www/vhosts/domain.com/statistics/logs is the correct path
    Your FTP access will typically start you at your HOME folder : /var/www/vhosts/domain.com/
     
    webwurks, Jun 15, 2009 IP
  4. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I just want to list the files at the logs directory first before I do anything else. And I got "open_basedir restriction in effect. File(../../statistics/logs) is not within the allowed path(s)" error. How should I explain it to the hosting company in order to change the restriction?

    $dir = opendir("../statistics/logs");

    //List files in images directory
    while (($file = readdir($dir)) !== false)
    {
    echo "filename: " . $file . "<br />";
    }
    closedir($dir);
    ?>
     
    aayybb, Jun 16, 2009 IP
  5. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The hosting company modified the open_basedir so it is working now.
    My next question is how to list the file with time stamp.
    readdir() only list the name of the file. I would like to know when the file is created also. Is there anyway to do it?
     
    aayybb, Jun 16, 2009 IP
  6. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    aayybb, Jun 17, 2009 IP