tags:

views:

402

answers:

2

Is it possible to translate a server relative virtual path to physical path in PHP?

e.g. if I have a url:

/home/index.php

then find the physical path of index.php somehow from some other script??

+2  A: 

Prepend $_SERVER["DOCUMENT_ROOT"] to the script path.

Ignacio Vazquez-Abrams
A: 

You're looking for realpath

$path = 'mydir/index.php';
echo realpath($path);
Benoit Vidis
Thanks benoit, that was what I was looking for.
r_honey