OK figured it out. Use $_SERVER['SCRIPT_FILENAME'] if over the browser. Over the command line, you can get the current symlinked directory using exec("pwd")
$_SERVER['SCRIPT_FILENAME']
exec("pwd")