Common Gateway Interface (CGI) is a method for Web servers to process and run executable scripts, or programs, and generate dynamic content for display in a...
Common Gateway Interface (CGI) is a method for web servers to process and run executable scripts or programs and generate dynamic content for display in a user's web browser.
What Is CGI?
CGI was designed to allow web browsers to run executable scripts. Under normal circumstances, when a web browser requests a webpage or file, the HTTP server simply serves up the requested file for display or download.
However, there are circumstances when simply displaying or downloading a file isn't the desired outcome. For example, when filling out and submitting a form, the goal is to have the form contents emailed to the website operator while providing the user confirmation that the form was submitted successfully.
This is where CGI comes into play. A site administrator can specify a folder to contain all executable scripts—commonly named "cgi-bin." When a web browser requests a URL pointing to one of these scripts, the HTTP server runs the script and returns the results, rather than serving up the script file itself.
