What about creating an include file in the same directory as your app.
Use it like so:
$trueDIR = include('get_true_dir.php');
From what you posted above, this should work. Yes, it's a bit of a hacky workaround, but it is a workaround, and should work even on systems not suffering from this issue.