If you know the absolute path to where you are, and where everything in your app is relative to the current code, you can construct any path to a file and any URL for a website.
What does it matter if it may be difficult to figure out what the document root of the domain is?
Well I use a custom framework, and having it automatically detect its correct location means, a site can be moved and all paths will work, both file and http.
That is what I was using before, but on godaddy accounts, it was invalid and had to be hard coded to get it to work. It works for most servers, so I’m just trying to find a solution that works for all.