In HTML, I can find a file starting from the web server\'s root folder by beginning the filepath with "/". Like:
/images/some_image
I've come up with a single line of code to set at top of my every php script as to compensate:
2;$i--) $root .= "../"; ?>
By this building $root to bee "../" steps up in hierarchy from wherever the file is placed. Whenever I want to include with an absolut path the line will be:
I don't really like it, seems as an awkward way to solve it, but it seem to work whatever system php runs on and wherever the file is placed, making it system independent.
To reach files outside the web directory add some more ../ after $root, e.g. $root."../external/file.txt".