note 100964 modified in reserved.variables.server by danbrown

From: Date: Wed, 17 Nov 2010 18:17:33 +0000
Subject: note 100964 modified in reserved.variables.server by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174128@lists.php.net to get a copy of this message
I needed to get the full base directory of my script local to my webserver, IIS 7 on Windows 2008. I ended up using this: <?php function GetBasePath() { return substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], "\\"))); } ?> And it returned C:\inetpub\wwwroot\<applicationfolder> as I had hoped. --was-- I needed to get the full base directory of my script local to my webserver, IIS 7 on Windows 2008. I ended up using this: function GetBasePath() { return substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], "\\"))); } And it returned C:\inetpub\wwwroot\<applicationfolder> as I had hoped. http://php.net/manual/en/reserved.variables.server.php

« previous php.notes (#174128) next »