Is there a function (or has someone else written one) that does the equivalent of ASP's Server.MapPath?

I know there are a few that will sort of do it, but quite often they will return stuff like ../../../../whatever - which is pretty much useless for my purposes! I'm after the full path on the local file system.

Say there is a page on a website named "index.html"...I'd like a function that would convert that to "/usr/local/home/httpd/htdocs/index.html" or "c:\apache\htdocs\index.html".

Any ideas?