Re: guess documentroot

From: Date: Thu, 05 Oct 2006 13:59:16 +0000
Subject: Re: guess documentroot
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242667@lists.php.net to get a copy of this message
Javier Ruiz wrote:
Hey all! Is it possible to get the path of a file relative to the document root of the webserver using php? For example... if we have a script like http://localhost/mydir/myseconddir/index.php is there a way to get that it's runing on /mydir/myseconddir/ ?? something like getcwd() but webserver relative, not filesystem.
$array = parse_url ( "http://localhost/mydir/myseconddir/index.php" ); $array2 = pathinfo ( $array['path'] ); $path = $array2['dirname']; -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#242667) next »