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/)',
  'HTTP_IF_MODIFIED_SINCE' => 'Sun, 14 Jul 2024 02:28:03 GMT',
  'DOCUMENT_ROOT' => '/home/w3dx/@subdomains/alpha/public_html',
  'REMOTE_ADDR' => '18.97.9.172',
  'REMOTE_PORT' => '49360',
  'SERVER_ADDR' => '185.199.220.59',
  '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' => 1738953952.396323,
  'REQUEST_TIME' => 1738953952,
)

[Home]