I'm brand new to php and I'm trying to work with some includes in my site and can't quite figure out how to make them all work correctly. My site structure is as follows
/ROOT/
Config.php
Index.php
/ADMINISTRATION/
Index.php
mustInclude.php
/USERS/
Index.php
If "mustInclude.php" includes "Config.php" and Index.php includes "mustInclude.php" everything works fine, but as soon as I try to include "mustInclude.php" into /USERS/Index.php it breaks because "mustInclude.php" is using a path like include '../config.php';
and that isn't the same relative path for /USERS/Index.php as for /ADMINISTRATION/Index.php
I'm not really sure what to do here.
This is on my local machine for now. Using $_SERVER['DOCUMENT_ROOT']
gives me errors because it outputs my file structure (/Users/James/Sites) rather than my web structure (http://localhost/mysite)
Help?