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 follow Wordpress's example on this one. I go and define a root path, normally the document root, and then go define a bunch of other path's along with that (one for each of my class dirs. IE: database, users, html, etc). Often I will define the root path manually instead of relying on a server variable.
Example
if($_SERVER['SERVERNAME'] == "localhost") { define("ABS_PATH", "/path/to/upper/most/directory"); // Manual } else { define("ABS_PATH, dirname(__FILE__)); // This defines the path as the directory of the containing file, normally a config.php } // define other paths... include(ABS_PATH."/mystuff.php");