Perl CGI Script 'Environment Variables'
Return to
Test Your Server
As may be reported by Master Pre-Installation Tester
CONTENT_LENGTH:
The number of characters that were sent to the script. If it was a form submission, it's the number of characters that were submitted -- fields, values, and any uploads.
If it was a web page, it would be number of characters the page is composed of. If it was an image file, it would be the byte size of the image.
CONTENT_TYPE:
The type of content the script received. The application/... shows it was a form submission. The /... part can vary depending on whether or not there were uploads.
If it was a web page, it would be "text/html". If it was an image file would be image/gif or image/jpg, etc.
DOCUMENT_ROOT:
The document root directory of the domain where the script is running.
GATEWAY_INTERFACE:
The name and version of the CGI gateway.
HTTP_ACCEPT:
Specifies what type of content the browser will accept as a response from the script. */* means anything/anything. The values can be anything the "CONTENT_TYPE" above could have, except it can also use * as a wildcard.
HTTP_ACCEPT_LANGUAGE:
The language of the content it will accept ("en" is "English"). This is used by the browser to determine how to render the characters.
HTTP_COOKIE:
The cookies the browser made available for the script.
Cookies names are the part before the = sign. The value the part after the = sign. The semi-colon and optional space separate multiple cookies. Only cookies set by the domain can be read by the script.
HTTP_HOST:
The domain name the script is running on.
HTTP_REFERER:
The URL of the web page that sent the browser to the script.
HTTP_USER_AGENT:
The browser/operating system identification.
PATH:
The paths the server scans when searching for helper software -- sendmail, perl, shell programs.
QUERY_STRING:
The part of the URL after the ? mark (if present).
REMOTE_ADDR:
The IP address of the browser.
REMOTE_PORT:
The port the browser is working through.
REQUEST_METHOD:
POST is a form submission with method "POST"
GET is either a form submission with method "GET" or a regular web page/other file request.
HEAD means the browser provided only the header lines (would be a CONTENT-LENGTH of zero).
REQUEST_URI:
The URL of the script minus the leading http://domain.com part -- usually. If there was a redirect involved, this one would contain the the URI of the original request and SCRIPT_URI (below) the URI of the script.
SCRIPT_FILENAME:
The complete server path of the script.
SCRIPT_NAME:
The name of the script, which is the server location (complete server path minus any non-public lower directories).
SERVER_ADDR:
The IP address of the server.
SERVER_ADMIN:
The contact email address that comes up in default error pages, like 404
SERVER_NAME:
The server name, almost always the domain name of the page in the browser.
SERVER_PORT:
The port at the server software through which the browser and server communicate. 80 is the default. Non-default ports need to be specified in the URL, like http://example.com:8888/page.html for port 8888.
SERVER_PROTOCOL:
The protocol type and version. With browsers, it's HTTP or HTTPS.
Return to
Test Your Server
Question:
Did you find this article interesting and understandable? How can it be improved?
Your response is anonymous.
When done typing, click anywhere outside the box. [more info]
Will Bontrager
©2007 Bontrager Connection, LLC
Please note:
Articles on this website are presented "as is". However -
If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Ask one of our Experts and you'll have your answer!
Click here for details.