note 14925 added to function.realpath.php

From: Date: Tue, 21 Aug 2001 16:25:31 +0000
Subject: note 14925 added to function.realpath.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16959@lists.php.net to get a copy of this message
I have PHP4 running on Win2k IIS and consequently the $DOCUMENT_ROOT is not automatically defined by PHP. Since I often need to find the absolute path of a virtual path, I created a workaround function that acts like server.mappath() from ASP:<br> // relative path to virtual directory root $relative = str_repeat('../',substr_count($PATH_INFO,'/')-1); function mappath($path) { // transforms virtual or relative path to an absolute path global $relative; return realpath(substr($path,0,1)=='/' ? $relative.substr($path,1) : $path); }<br> Hope this is helpful to some of you.<br> > Dave [twadzilla.com] http://www.php.net/manual/en/function.realpath.php

« previous php.notes (#16959) next »