What Does Common Gateway Interface Mean?
Common Gateway Interface (CGI), in the the context of web development, is an interface for running executables via a web-server. In most intances, this means taking an HTTP request and passing it to an application in order to deliver a dynamically-generated HTML page back to a browser. While pretty much any program that can run on a web server is usable as a CGI script, Perl is the most popular language.
The standard for CGI is defined in RFC 3875.
Techopedia Explains Common Gateway Interface
In the early days of web development CGI was one of the few ways to provide interactivity in a web application. It was most common on Apache, but ports were made to run CGI on IIS as well.
The most common usage of CGI is using scripting languages, and so it’s common to refer to this as running a CGI script. CGI programs and scripts are usually collected in a folder named /cgi-bin/.
The main disadvantage of CGI is that each page load incurs overhead by having to load the programs into memory. Data cannot easily be cached in memory between page loads. Because of this disadvantage, many developers have moved to application servers that remain running. However, there is a huge existing code base, much of it in Perl. Proponents of CGI argue that it is simple, stable, and a good choice for certain applications, especially involving tasks where Perl excels, such has text handling. Workarounds also avoid loading in the Perl or PHP runtime for each request by including the runtime in the web server (mod_perl and mod_php in Apache), or other solutions such as FastCGI (separate processes that handle multiple requests).