PHP – What Do the Individual Paths in the $_SERVER Array Return?

I will not cover all the indexes you can find at https://www.php.net/manual/en/reserved.variables.server.php, only those that relate to some parent folder of the current file, the current file itself, or any other path.

The test was done by having the file _SERVER.php print out the values I was interested in, and I placed this file in the folder subfolder, which was in turn located in the root of the website/localhost. I called the script itself with the query string a=b, so the full address was: localhost/subfolder/_SERVER.php?a=b

Here are the results:

PHP_SELF: /subfolder/_SERVER.php
SCRIPT_NAME: /subfolder/_SERVER.php
ORIG_PATH_INFO: /subfolder/_SERVER.php

DOCUMENT_ROOT: F:\Mona\Visual Studio 2012\Projects\PhpLearn\PhpLearn
HTTP_HOST: localhost
SCRIPT_FILENAME: F:\Mona\Visual Studio 2012\Projects\PhpLearn\PhpLearn\subfolder\_SERVER.php
PATH_TRANSLATED: F:\Mona\Visual Studio 2012\Projects\PhpLearn\PhpLearn\subfolder\_SERVER.php

REQUEST_URI: /subfolder/_SERVER.php?a=b

Categories

Leave a Reply