Re: webserver root

From: Date: Fri, 07 Sep 2001 16:10:44 +0000
Subject: Re: webserver root
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-9233@lists.php.net to get a copy of this message
PHP 4.0.7 or 4.0.8 is going to fix this problem as it will search for files in the current directory. I forget which version. The patch is already in CVS. To find the document root, here's some code taken from http://phplens.com // Finds the DOCUMENT_ROOT - works with Apache, IIS and PWS function PHPLENS_RootPath() { GLOBAL $HTTP_SERVER_VARS; if (isset($HTTP_SERVER_VARS['DOCUMENT_ROOT'])) { // APACHE and PWS $_p_file = (str_replace('\\\\','/',$HTTP_SERVER_VARS['DOCUMENT_ROOT'])); // compat for php4.02 on windows return (str_replace('\\','/',$_p_file)); } if (isset($HTTP_SERVER_VARS['APPL_PHYSICAL_PATH'])) { // IIS $_p_file = (str_replace('\\\\','/',$HTTP_SERVER_VARS['APPL_PHYSICAL_PATH'])); // compat for php4.02 on windows return (str_replace('\\','/',$_p_file)); } } //function "Mitja Pagon" <mitja@hatchbit.com> wrote in message news:20010907154223.86235.qmail@pb1.pair.com... > Hi! > > I'm am an ASP developer, that decided to give PHP a try. So far I have been > nothing but impresed by PHP. But I have found one problem, that i can't find > a solution to. > When including files in ASP pages using <!--#virtual="/filename.asp"--> I > was able to include files into pages using path relative to the webserver > root. I have tried similar in PHP using include("/filename.php"), but just > recently learned that "/" slash charachter moves the pointer to the root of > the drive on which webserver directory is located on. I'm running PHP 4.0.6 > on WinNT with IIS4.0, therefor $DOCUMENT_ROOT variable doesn't work. I'm > writing an application that should be portable not just from server to > server, but also from platform to platform, so I can't have fixed paths in > my scripts. > My question is: "Is there any way I can get the root of the webserver in a > fashion simmilar to that of the method ASP uses?" > > Thanks, > > Mitja Pagon > > > >

« previous php.windows (#9233) next »