I have several subdomains contained in their own directory above my root site, and an assets folder in my root directory. For example:
/
/assets/
/forums/
/b
So...you can use this, in both pgm1.php & pgm1.php, and REQUIRE or
INCLUDE works !
function rURI($p){
for($w='',$i=1;$i<(count(explode('/',$_SERVER['PHP_SELF']))-1);$i++,$w.='../');return
$w.$p; }
require rURI('dirA/inc/Xpto.php'); // path from root