Use dirname() with predefined variable $SCRIPT_FILENAME to obtain the complete path of the script executing the command
<? $dir = dirname($SCRIPT_FILENAME); print $dir; ?>