Hallo phpfreaks,
I`m new to this specific forum so I would like to contribute to some topics in the future.
My question here is about absolute php paths.
Right now I`m busy with making my own cms and I want to make it as flexible as possible.
I`m not a fan of frameworks or library's so I`m making everything by myself (for this project).
I already found a specific script that does exactly what I want to accomplish but I`m not so happy
with that it uses
$_SERVER['DOCUMENT_ROOT']
and this is the script that I found:
substr(
str_replace(
'\\', '/', realpath(dirname(__FILE__))),
strlen(
str_replace(
'\\', '/', realpath($_SERVER['DOCUMENT_ROOT']))));
At this moment I`m using Windows so this is the output that I get with it:
/Projects/cms/5113/htdocs2
I was hoping that someone would know a alternative to the $_SERVER part.
If it`s unclear what I`m trying to accomplish I`ll just write the whole story for you.