Appendix B. CGI Environment Variables
Standard CGI Variables
Note that variables not defined by the CGI specification are marked with a star (
). In addition, HTTP request header field values are added to the environment with the prefix HTTP_, and any hyphens in the header field name are changed to underscores (the Authorization and Proxy-Authorization headers are omitted for security reasons).
AUTH_TYPEAuthentication method used (only if request is subject to authentication)
CONTENT_LENGTHLength of the entity body (for POST requests)
CONTENT_TYPEMIME type of the entity body (for POST requests)
DOCUMENT_ROOT
Value of the
DocumentRootdirective.GATEWAY_INTERFACECGI version
PATH_INFOURL part after script identifier (if present)
PATH_TRANSLATEDPATH_INFOtranslated into filesystemQUERY_STRINGQuery string from URL (if present)
REMOTE_ADDRIP address of client
REMOTE_HOSTDNS name of client (if resolved)
REMOTE_IDENTRemote user ID (unreliable, even if available)
REMOTE_USERName of the authenticated user (only if request is subject to authentication)
REQUEST_METHODHTTP request method
REQUEST_URI
URI of the request from the HTTP request line
SCRIPT_FILENAMEFull pathname of the script
SCRIPT_NAMEVirtual path of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access