Resources >
Environment Variables


AUTH_TYPE When the browser authenticates itself, this variable contains the authentication type in use. The most common value is Basic.

COMSPEC Reports the path to COMMAND.COM when run locally in Windows.

CONFIGS If any server configuration options were set, this is a space-separated array of them all.

CONTENT_LENGTH The length of the data (in bytes or the number of characters) passed to the CGI program through standard input.

CONTENT_TYPE The MIME type of the query data, such as "text/html".

COOKIE_name The value of the cookie name.

COOKIES A space-separated list of all cookie names sent with this request.

DATE_GMT Current date and time in GMT.

DATE_LOCAL Current date and time in the local time zone.

DOCUMENT_NAME The current file.

DOCUMENT_PATH_INFO Additional path information passed to a document.

DOCUMENT_ROOT The root directory of the server (so you can use the same script on multiple sites).

DOCUMENT_URI Virtual path to the file.

GATEWAY_INTERFACE The revision of the Common Gateway Interface that the server uses.

HTTP_ACCEPT A list of the MIME types that the client can accept.

HTTP_ACCEPT_CHARSET The contents of the HTTP Accept-Charset header of the request.

HTTP_ACCEPT_ENCODING The contents of the HTTP Accept-Encoding header of the request.

HTTP_ACCEPT_LANGUAGE The contents of the HTTP Accept-Language header of the request.

HTTP_AUTHORIZATION The contents of the HTTP Authorization header of the request. It will only be available if the Raw user info variable has been set to Yes by the server administrator.

HTTP_CACHE_CONTROL Information about how to handle the caching od the object requested.

HTTP_CONNECTION A lowercased version of the HTTP Connection header; typically keep-alive.

HTTP_COOKIE If you've set a cookie, this holds its value.

HTTP_FORWARDED An old variant of the Via: header.

HTTP_FROM The email address of the user making the request. Most browsers do not support this variable.

HTTP_HOST The net_loc part of the URL, as sent in the HTTP Host header, for instance localhost:4711.

HTTP_PRAGMA If the client sent any pragma header(s), they are provided here. For practical purposes, the only pragma header you are likely to encounter is no-cache, which some browsers (Netscape comes to mind) send when the user reloads the page.

HTTP_PROXY_CONNECTION The contents of the HTTP Proxy-Connection header of the request.

HTTP_REFERER The URL of the document that the client points to before accessing the CGI program.

HTTP_UA_COLOR The color information of the client.

HTTP_UA_CPU The processor type used by the client.

HTTP_UA_OS The operating system used by the client.

HTTP_UA_PIXELS The screen resolution of the client.

HTTP_USER_AGENT The browser the client is using to issue the request.

HTTP_VIA Information about the proxy servers eventually used for making the request.

HTTPS Returns 'true' if the server is secure.

INDEX The query part of the URL, if present.

LAST_MODIFIED Last modification date and time for current file.

PAGE_COUNT Number of accesses to current document since server was brought on line.

PATH The system path your system is running on.

PATH_INFO Extra path information passed to a CGI program.

PATH_TRANSLATED The translated version of the path given by the variable PATH_INFO.

PRESTATE_name The value true if that prestate was present.

PRESTATES If server found prestates in the URL, this is a space-separated array of those present.

PRINTENV A special XSSI command which returns ALL environment variables, including those which have been set within the page. Note that, like flastmod and fsize, it is a directive in itself and does not require 'echo var=' in its argument.

QUERY_name The value of the form variable name.

QUERY_STRING The query information passed to the program. It is appended to the URL with a "?".

QUERY_STRING_UNESCAPED Undecoded query string with all shell metacharacters escaped with "".

REDIRECT_SCRIPT_NAME The virtual path of the parent document.

REDIRECT_STATUS The status code of the parent request. It is useful when writing scripts that generate custom error pages.

REMOTE_ADDR The remote IP address of the user making the request.

REMOTE_HOST The remote hostname of the user making the request.

REMOTE_IDENT The user making the request. This variable will only be set if NCSA IdentityCheck flag is enabled, and the client machine supports the RFC 931 identification scheme (ident daemon).

REMOTE_PASSWORD The password used by the user, only available if the Send decoded password variable is set to Yes by the administrator and the client authenticated itself.

REMOTE_PORT The port number used by the client.

REMOTE_USER The authenticated name of the user.

REQUEST_METHOD The method with which the information request was issued.

REQUEST_URI The address of the requested document or CGI file, relative to the document root.

SCRIPT_FILENAME The complete path in the real file system to the CGI script.

SCRIPT_NAME The virtual path (e.g., /cgi-bin/ of the script being executed.

SCRIPT_URI The absolute URL of the CGI script called.

SCRIPT_URL The URL path of the CGI script called.

SERVER_ADDR The server's DNS address.

SERVER_ADMIN The e-mail address of your server's webmaster.

SERVER_NAME The server's hostname or IP address.

SERVER_PORT The port number of the host on which the server is running.

SERVER_PROTOCOL The name and revision of the information protocol the request came in with.

SERVER_SIGNATURE Used server error messages.

SERVER_SOFTWARE The name and version of the server software that is answering the client request.

SERVER_URL The URL to the web server. Together with SCRIPT_NAME, this makes up the complete URL for the script.

SUPPORTS A list of words, separated with spaces, of all features for which support information is available.>

SUPPORTS_feature The value true if that feature is supported by the current browser.

TOTAL_HITS Total pages served by server since brought on line.

TZ Time zone.

UNIQUE_ID Serial no. of the server.

USER_INFO Identity of current site as known by the server.

USER_NAME The name of the user who started Apache.

VAR_name The value of the form variable name.

VARIABLES A list of all form variables.

WANTS_name The value true if that server configuration option was set. See also CONFIGS.