I can\'t believe PHP doesn\'t have an easy solution for this simple matter. ASP.NET has a ~ sign that takes care of this issue and starts everything from the root level. Her
The best way to do this given your setup is to define a constant describing the root path of your site. You can create a file config.php at the root of your application:
Then include config.php in each entry point script and reference SITE_ROOT in your code rather than giving a relative path.