Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Common Gateway Interface
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Purpose == Traditionally a [[Web server]] has a [[directory (computing)|directory]] which is designated as a document collection, that is, a set of files that can be sent to Web browsers connected to the server.<ref>{{cite web| url = http://httpd.apache.org/docs/2.2/urlmapping.html| title = Mapping URLs to Filesystem Locations Apache HTTP Server Version 2.2| access-date = 16 July 2014| archive-date = 15 July 2014| archive-url = https://web.archive.org/web/20140715152526/http://httpd.apache.org/docs/2.2/urlmapping.html| url-status = live}}</ref> For example, if a web server has the [[FQDN|fully-qualified domain name]] <code>www.example.com</code>, and its document collection is stored at <code>/usr/local/apache/htdocs/</code> in the local [[file system]] (its ''document root''), then the web server will respond to a request for <code><nowiki>http://www.example.com/index.html</nowiki></code> by sending to the browser a copy of the file <code>/usr/local/apache/htdocs/index.html</code> (if it exists). For pages constructed on the fly, the server software may defer requests to separate programs and relay the results to the requesting client (usually, a Web browser that displays the page to the end user). Such programs usually require some additional information to be specified with the request, such as [[query string]]s or [[HTTP cookie|cookies]]. Conversely, upon returning, the script must provide all the information required by HTTP for a response to the request: the HTTP status of the request, the document content (if available), the document type (e.g. HTML, PDF, or plain text), et cetera. Initially, there were no standardized methods for data exchange between a browser, the HTTP server with which it was communicating and the scripts on the server that were expected to process the data and ultimately return a result to the browser. As a result, mutual incompatibilities existed between different HTTP server variants that undermined script [[software portability|portability]]. Recognition of this problem led to the specification of how data exchange was to be carried out, resulting in the development of CGI. Web page-generating programs invoked by server software that adheres to the CGI specification are known as ''CGI scripts'', even though they may actually have been written in a non-scripting language, such as [[C (programming language)|C]]. The CGI specification was quickly adopted and continues to be supported by all well-known HTTP server packages, such as [[Apache HTTP Server|Apache]], [[Internet Information Services|Microsoft IIS]], and (with an extension) [[Node.js]]-based servers. An early use of CGI scripts was to process forms. In the beginning of HTML, HTML forms typically had an "action" attribute and a button designated as the "submit" button. When the submit button is pushed the URI specified in the "action" attribute would be sent to the server with the data from the form sent as a query string. If the "action" specifies a CGI script then the CGI script would be executed, the script in turn generating an HTML page.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)