A key problem to hierarchical include trees is that PHP processes include paths relative to the original file, not the current including file.
A solution to that, is to prefix all include paths with:
<?php str_replace('//','/',dirname(__FILE__)); ?>
this will generate a base path relative to the current file, which will then allow an include behavior similar to C/C++.
thus, to include a file that is 1 in the parent directory:
<?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'../parent.php'); ?>
to include a file that is in the same directory:
<?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'neighbor.php'); ?>
to include a file that is in a subdirectory:
<?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'folder/sub.php'); ?>
Notice that all paths we reference must NOT begin with a /, and must be relative to the current file, in order to concatenate correctly.