0

Hello,

I need a php code that can detect the root foldername that my website is installed to. I need to use this constant in my bootstrap.php so it can't be relative to where the file is called from. Atm I have my root folder and admin folder. I need the index.php at my admin folder to be able to use the installation folder name. How can this be achieved ?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Martin C++
1
echo __DIR__;

will give the exact location of the system from the point of view of the actual file where it's called - not the parent file if it is an include file.

Is that it?

echo $_SERVER['DOCUMENT_ROOT'];

*should* give you the document root (path to public root).

Edited by diafol: n/a

Votes + Comments
Nice reply, solved my problem
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.