I've been wandering for a while trying to get out of this problem.
I have a php software in which I want to know where the script is being executed.
e.g.
I have /foo/bar/home.php . In this case I would like to know that /foo/bar is my root. But if I have an example admin page /foo/bar/admin/index.php I would like to have /foo/bar in this case too. Or
/foo/bar/foo/index.php -> /foo/bar/foo /foo/bar/foo/randomname/home.php -> /foo/bar/foo
How can I accomplish that ?
Thanks for help