Re: [PHP] guess documentroot

2006-10-09 Thread Ivo F.A.C. Fokkema
On Thu, 05 Oct 2006 16:35:04 +0200, Javier Ruiz wrote: Perfect! got it using the following: /* 1 - remove the query string just in case it contains a '/' in it 2 - like Clive said, substr() and strrpos() 'clean' the path to provide the directories only */ $aPath =

[PHP] guess documentroot

2006-10-05 Thread Javier Ruiz
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

Re: [PHP] guess documentroot

2006-10-05 Thread John Nichel
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

Re: [PHP] guess documentroot

2006-10-05 Thread clive
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/ use $_SERVER['[PHP_SELF'] or $_SERVER['SCRIPT_NAME'] and then simply use strripos() to get the last forwarsd-slash and substr() to get the value you want.

Re: [PHP] guess documentroot

2006-10-05 Thread Javier Ruiz
Perfect! got it using the following: /* 1 - remove the query string just in case it contains a '/' in it 2 - like Clive said, substr() and strrpos() 'clean' the path to provide the directories only */ $aPath = str_replace($_REQUEST['QUERY_STRING'], '', $_SERVER['SCRIPT_NAME']); $aPath =

Re: [PHP] guess documentroot

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 8:42 am, Javier Ruiz wrote: 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