I don't really understand what your asking but I'll try to explain those two pre-defined variables.
$DOCUMENT_ROOT:
The root folder of the current site. For Example, "\Program Files\Apache Group\Apache\htdocs" would be the default install.
$SCRIPT_NAME:
The name of the current php script running. If your file name is foo.php then it will return foo.php and the path to that file. So if it was in the root directory from the example above it would return: "\Program Files\Apache Group\Apache\htdocs\foo.php"
Instead of $SCRIPT_NAME I have always used $PHP_SELF but if PHP is running as a command-line processor, $PHP_SELF is not available.
Hope that helps.
Chris