including a file outside the accessable area

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    #1

    including a file outside the accessable area

    Hi everyone
    Does anyone know how to include a file outside the HTDOCS root?

    When I login to my ftp htdoc is the folder where I put my index.php but I want to put a file outside this folder and include it in the index file

    Code:
    file.php
    HTDOCS (folder)+
                   |
                   -index.php
    I just need to know what address I should use to include file.php
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, bnashenas1984.

    Use a relative path, or add it to your include_path. For example:
    [code=php]
    require_once dirname(__FILE_ _) . '../privateIncludes/file.php';
    [/code]

    Alternatively:
    [code=php]
    ini_set( '/absolute/path/to/include/folder:' . ini_get('includ e_path') );
    require_once 'file.php';
    [/code]

    Comment

    Working...