AE117 Posted April 17, 2009 Share Posted April 17, 2009 Ok heres the deal I installed a PEAR package using a hosting company and it install the package under /home/php which is outside and above my public_html I have a file which is under the public_html/folder/folder/folder/file.php that has a require statement to a folder located in the folder under the home/php so my question is how do i point to a file above the public_html? Thanks Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/ Share on other sites More sharing options...
The Little Guy Posted April 18, 2009 Share Posted April 18, 2009 "../" dot dot slash means move up one directory, from the current file/location Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/#findComment-812810 Share on other sites More sharing options...
AE117 Posted April 18, 2009 Author Share Posted April 18, 2009 "../" dot dot slash means move up one directory, from the current file/location correct but here is the problem is i only use dot dot slash it takes me to and outside folder thats it. The file is located with in another folder outside of the php file containing folder. So not only do i need to move out of my current file location i need to move into another one Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/#findComment-812827 Share on other sites More sharing options...
jackpf Posted April 18, 2009 Share Posted April 18, 2009 include('../otherdir/file.php'); Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/#findComment-812845 Share on other sites More sharing options...
trq Posted April 18, 2009 Share Posted April 18, 2009 You will need to use an absolute path. include "/home/username/php/foo.php"; An even better option would be to add the required directory to your include_path in your php.ini if you have access to it. Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/#findComment-812863 Share on other sites More sharing options...
jackpf Posted April 18, 2009 Share Posted April 18, 2009 Or $_SERVER['DOCUMENT_ROOT'] Link to comment https://forums.phpfreaks.com/topic/154573-solved-include-file-above-public_html/#findComment-812864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.