$_SERVER['DOCUMENT_ROOT']
<?php echo $_SERVER['DOCUMENT_ROOT']; ?>
The document root directory under which the current script is executing, as defined in the server's configuration file.
$_SERVER['GATEWAY_INTERFACE']
<?php echo $_SERVER['GATEWAY_INTERFACE']; ?>
What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.
$_SERVER['HTTP_ACCEPT']
<?php echo $_SERVER['HTTP_ACCEPT']; ?>
Contents of the Accept: header from the current request, if there is one.
$_SERVER['HTTP_ACCEPT_CHARSET']
<?php echo $_SERVER['HTTP_ACCEPT_CHARSET']; ?>
Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.
$_SERVER['HTTP_ACCEPT_ENCODING']
<?php echo $_SERVER['HTTP_ACCEPT_ENCODING']; ?>
Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.
$_SERVER['HTTP_ACCEPT_LANGUAGE']
<?php echo $_SERVER['HTTP_ACCEPT_LANGUAGE']; ?>
Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.
$_SERVER['HTTP_CONNECTION']
<?php echo $_SERVER['HTTP_CONNECTION']; ?>
Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.
$_SERVER['HTTP_HOST']
<?php echo $_SERVER['HTTP_HOST']; ?>
Contents of the Host: header from the current request, if there is one.
$_SERVER['HTTP_REFERER']
<?php echo $_SERVER['HTTP_REFERER']; ?>
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
$_SERVER['HTTP_USER_AGENT']
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.
$_SERVER['PATH_TRANSLATED']
<?php echo $_SERVER['PATH_TRANSLATED']; ?>
Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.
Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined.
Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.
$_SERVER['PHP_SELF']
<?php echo $_SERVER['PHP_SELF']; ?>
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
$_SERVER['QUERY_STRING']
<?php echo $_SERVER['QUERY_STRING']; ?>
The query string, if any, via which the page was accessed.
$_SERVER['REMOTE_ADDR']
<?php echo $_SERVER['REMOTE_ADDR']; ?>
The IP address from which the user is viewing the current page.
$_SERVER['REMOTE_PORT']
<?php echo $_SERVER['REMOTE_PORT']; ?>
The port being used on the user's machine to communicate with the web server.
$_SERVER['REQUEST_METHOD']
<?php echo $_SERVER['REQUEST_METHOD']; ?>
Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
Note: PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD.
$_SERVER['REQUEST_URI']
<?php echo $_SERVER['REQUEST_URI']; ?>
The URI which was given in order to access this page; for instance, '/index.html'.
$_SERVER['SCRIPT_FILENAME']
<?php echo $_SERVER['SCRIPT_FILENAME']; ?>
The absolute pathname of the currently executing script.
Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
$_SERVER['SCRIPT_NAME']
<?php echo $_SERVER['SCRIPT_NAME']; ?>
Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
$_SERVER['SERVER_ADMIN']
<?php echo $_SERVER['SERVER_ADMIN']; ?>
The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host.
$_SERVER['SERVER_NAME']
<?php echo $_SERVER['SERVER_NAME']; ?>
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
$_SERVER['SERVER_PORT']
<?php echo $_SERVER['SERVER_PORT']; ?>
The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is.
$_SERVER['SERVER_PROTOCOL']
<?php echo $_SERVER['SERVER_PROTOCOL']; ?>
Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
$_SERVER['SERVER_SIGNATURE']
<?php echo $_SERVER['SERVER_SIGNATURE']; ?>
String containing the server version and virtual host name which are added to server-generated pages, if enabled.
$_SERVER['SERVER_SOFTWARE']
<?php echo $_SERVER['SERVER_SOFTWARE']; ?>
Server identification string, given in the headers when responding to requests.
Info taken from php.net
some of those echo example might not work because some of those variables don't have output!

Sign In
Register
Help

This topic is locked


MultiQuote