Current Working Directory and other SERVER vars

What is the current working directory (CWD) when including a file? And other reported SERVER vars...

This file reports as:

  1. CWD = "/home/w3dx/@subdomains/alpha/public_html/php/getcwd"
  2. DOCUMENT_ROOT = "/home/w3dx/@subdomains/alpha/public_html"
  3. PHP_SELF = "/php/getcwd/getcwd.php"
  4. SCRIPT_NAME = "/php/getcwd/getcwd.php"
  5. SCRIPT_FILENAME = "/home/w3dx/@subdomains/alpha/public_html/php/getcwd/getcwd.php"
  6. __FILE__ = "/home/w3dx/@subdomains/alpha/public_html/php/getcwd/getcwd.php"
  7. REQUEST_URI = "/php/getcwd/getcwd.php"
  8. QUERY_STRING = ""

Having included a file from "/includes/included_file_details.php", what are the details reported from this included file?

  1. CWD = "/home/w3dx/@subdomains/alpha/public_html/php/getcwd"
  2. DOCUMENT_ROOT = "/home/w3dx/@subdomains/alpha/public_html"
  3. PHP_SELF = "/php/getcwd/getcwd.php"
  4. SCRIPT_NAME = "/php/getcwd/getcwd.php"
  5. SCRIPT_FILENAME = "/home/w3dx/@subdomains/alpha/public_html/php/getcwd/getcwd.php"
  6. __FILE__ = "/home/w3dx/@subdomains/alpha/public_html/includes/included_file_details.php"
  7. REQUEST_URI = "/php/getcwd/getcwd.php"
  8. QUERY_STRING = ""

KEY: Difference, otherwise the same.

$_SERVER[] array

array (
  'PATH' => '/usr/local/bin:/bin:/usr/bin',
  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_ACCEPT_ENCODING' => 'br,gzip',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
  'HTTP_CONNECTION' => 'Keep-Alive',
  'HTTP_HOST' => 'alpha.w3dx.co.uk',
  'HTTP_USER_AGENT' => 'CCBot/2.0 (https://commoncrawl.org/faq/)',
  'DOCUMENT_ROOT' => '/home/w3dx/@subdomains/alpha/public_html',
  'REMOTE_ADDR' => '3.81.28.10',
  'REMOTE_PORT' => '33864',
  'SERVER_ADDR' => '77.72.4.66',
  'SERVER_NAME' => 'alpha.w3dx.co.uk',
  'SERVER_ADMIN' => 'webmaster@alpha.w3dx.co.uk',
  'SERVER_PORT' => '80',
  'REQUEST_SCHEME' => 'http',
  'REQUEST_URI' => '/php/getcwd/getcwd.php',
  'SCRIPT_FILENAME' => '/home/w3dx/@subdomains/alpha/public_html/php/getcwd/getcwd.php',
  'QUERY_STRING' => '',
  'SCRIPT_URI' => 'http://alpha.w3dx.co.uk/php/getcwd/getcwd.php',
  'SCRIPT_URL' => '/php/getcwd/getcwd.php',
  'SCRIPT_NAME' => '/php/getcwd/getcwd.php',
  'SERVER_PROTOCOL' => 'HTTP/1.1',
  'SERVER_SOFTWARE' => 'LiteSpeed',
  'REQUEST_METHOD' => 'GET',
  'X-LSCACHE' => 'on',
  'PHP_SELF' => '/php/getcwd/getcwd.php',
  'REQUEST_TIME_FLOAT' => 1593958815.6882450580596923828125,
  'REQUEST_TIME' => 1593958815,
)

[Home]