Page 1 of 1

Is there any function in PHP like that Server.mappath in ASP

Posted: Fri Mar 26, 2004 4:48 am
by fadi
hi
i wan2 know if there is any function in PHP which returns the path of file on any server like that server.mappath(filepath and name) in ASP ?

Posted: Fri Mar 26, 2004 4:55 am
by JayBird
how about $_SERVER['PHP_SELF']

Other that may be useful can be found here - http://uk.php.net/reserved.variables

Mark

Posted: Sat Mar 27, 2004 10:03 am
by Weirdan
Probably you're looking for __FILE__ constant:

Code: Select all

echo __FILE__; // echoes /home/www/yousite.com/yourfile.php

Posted: Sat Mar 27, 2004 2:02 pm
by darkforcesjedi
no, he's looking for realpath

server.mappath returns the absolute path for a directory
server.mappath("/directory/file.php") returns "c:\inetpub\wwwroot\directory\file.php"

the same is the case with realpath; however, this doesn't seem to work with virtual directories

Posted: Tue Mar 30, 2004 8:36 pm
by Weirdan
virtual-to-real mapping are available in PHP (for current file only) through $_SERVER['PATH_TRANSLATED'] variable