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' => '*/*',
  'HTTP_ACCEPT_ENCODING' => 'gzip, br, zstd, deflate',
  'HTTP_HOST' => 'alpha.w3dx.co.uk',
  'HTTP_USER_AGENT' => 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)',
  'DOCUMENT_ROOT' => '/home/w3dx/@subdomains/alpha/public_html',
  'REMOTE_ADDR' => '216.73.216.17',
  'REMOTE_PORT' => '49094',
  'SERVER_ADDR' => '185.199.220.59',
  'SERVER_NAME' => 'alpha.w3dx.co.uk',
  'SERVER_ADMIN' => 'webmaster@alpha.w3dx.co.uk',
  'SERVER_PORT' => '443',
  'REQUEST_SCHEME' => 'https',
  'REQUEST_URI' => '/php/getcwd/getcwd.php',
  'HTTPS' => 'on',
  'CRAWLER_USLEEP' => '1000',
  'CRAWLER_LOAD_LIMIT' => '20',
  'X_SPDY' => 'HTTP2',
  'SSL_PROTOCOL' => 'TLSv1.3',
  'SSL_CIPHER' => 'TLS_AES_256_GCM_SHA384',
  'SSL_CIPHER_USEKEYSIZE' => '256',
  'SSL_CIPHER_ALGKEYSIZE' => '256',
  'SCRIPT_FILENAME' => '/home/w3dx/@subdomains/alpha/public_html/php/getcwd/getcwd.php',
  'QUERY_STRING' => '',
  'SCRIPT_URI' => 'https://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,crawler',
  'PHP_SELF' => '/php/getcwd/getcwd.php',
  'REQUEST_TIME_FLOAT' => 1777553235.732424,
  'REQUEST_TIME' => 1777553235,
)

[Home]