note 100964 deleted from reserved.variables.server by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 19:07:35 +0000 |
| Subject: | note 100964 deleted from reserved.variables.server by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217890@lists.php.net to get a copy of this message | ||
Note Submitter: rulerof at gmail dot com
----
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.