Page 1 of 1

how to find the absolute path

Posted: Mon Dec 04, 2006 3:40 pm
by iffo
Hi,

Suppose I have a file run.php. I want to have a code in the file which will tell me where it is located,
is there any function in php that will give me the exact path of the file run.php

Thanks

Posted: Mon Dec 04, 2006 3:47 pm
by neophyte
I think this will do it.

Code: Select all

$_SERVER['SCRIPT_FILENAME'];
Global server variables.

Posted: Mon Dec 04, 2006 5:09 pm
by feyd

Posted: Mon Dec 04, 2006 5:54 pm
by s.dot
what about getcwd() :P

Posted: Mon Dec 04, 2006 6:49 pm
by RobertGonzalez
realpath(). And I think this question has been asked before. Have you search our forums?