Server Variables

Here is a list of the server variables which may be used in the GET_SERVER shortcode.


‘PHP_SELF’

The filename of the currently executing script, relative to the document root.

‘GATEWAY_INTERFACE’

CGI version in use; i.e. ‘CGI/1.1’.

‘SERVER_ADDR’
The IP address of the server.

‘SERVER_NAME’
The name of the server host.

‘SERVER_SOFTWARE’
Server identification string for response headers.

‘SERVER_PROTOCOL’
Name and version of the information protocol ; i.e. ‘HTTP/1.0’;

‘REQUEST_METHOD’
Method was used to access the page; i.e. ‘GET’, ‘POST’, etc.

‘REQUEST_TIME’
The timestamp of the start of the request.

‘REQUEST_TIME_FLOAT’
The timestamp of the start of the request, with microsecond precision.

‘QUERY_STRING’
The query string.

‘DOCUMENT_ROOT’
The document root directory inside which the current node is executing.

‘HTTP_ACCEPT’
Contents of the Accept: header from the current request.

‘HTTP_ACCEPT_CHARSET’
Contents of the Accept-Charset: header from the current request. Example: ‘iso-8859-1,*,utf-8’.

‘HTTP_ACCEPT_ENCODING’
Contents of the Accept-Encoding: header from the current request. Example: ‘gzip’.

‘HTTP_ACCEPT_LANGUAGE’
Contents of the Accept-Language: header from the current request. Example: ‘en’.

‘HTTP_CONNECTION’
Contents of the Connection: header from the current request. Example: ‘Keep-Alive’.

‘HTTP_HOST’
Contents of the Host: header from the current request.

‘HTTP_REFERER’
The address of the page (if any) which referred the user agent to the current page. . This may be easily spoofed with some browsers so it is not to be relied upon for security..

‘HTTP_USER_AGENT’
Contents of the User-Agent: header from the current request. May also be spoofed.

‘HTTPS’
Set to a non-empty value if the script was queried through the HTTPS protocol.

Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.

‘REMOTE_ADDR’
The IP address from which the user is viewing the current page.

‘REMOTE_HOST’
The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.

Note: Your web server must be configured to create this variable. For example in Apache you’ll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().

‘REMOTE_PORT’
The port being used on the user’s machine to communicate with the web server.

‘REMOTE_USER’
The authenticated user.

‘REDIRECT_REMOTE_USER’
The authenticated user if the request is internally redirected.

‘SCRIPT_FILENAME’

The absolute path name of the currently executing script.

‘SERVER_ADMIN’

‘SERVER_PORT’

‘SERVER_SIGNATURE’

‘PATH_TRANSLATED’

Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.

‘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.

‘REQUEST_URI’

The URI which was given in order to access this page; for instance, ‘/index.html’.

‘PHP_AUTH_DIGEST’

When doing Digest HTTP authentication this variable is set to the ‘Authorization’ header sent by the client (which you should then use to make the appropriate validation).

‘PHP_AUTH_USER’

When doing HTTP authentication this variable is set to the username provided by the user.

‘PHP_AUTH_PW’

When doing HTTP authentication this variable is set to the password provided by the user.

‘AUTH_TYPE’

When doing HTTP authentication this variable is set to the authentication type.

‘PATH_INFO’

Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER[‘PATH_INFO’] would contain /some/stuff.

‘ORIG_PATH_INFO’

Original version of ‘PATH_INFO’ before processed by PHP.

Note: add COOKIES

Leave a Reply