which is usually what Cwd does on
unix systems. It has a few other options,
such as fastcwd() and getcwd() but they
are not used much. You can grab the name
of the script itself by looking in $0 or even __FILE__.
If you are doing it through the web,
check out the environment variable