Glossary term
CGI Scripts
A CGI script is a server-side program that receives a web request through the Common Gateway Interface and returns a response.
The page could finally do something. Sign a guestbook, submit a form, watch a counter go up: behind many small acts of early-web participation was a program running on somebody’s server. CGI was one way the web server handed that program the request.
What does CGI stand for?
CGI means Common Gateway Interface. In web development, it describes an interface between a web server and an external program. It is unrelated to the other familiar meaning of CGI: computer-generated imagery.
When a homepage could do something
CGI programs processed forms and generated responses instead of simply returning a fixed file. Guestbooks, hit counters, and email forms made this visible to everyday visitors. Matt’s Script Archive preserves examples of the downloadable scripts site owners used for those jobs.
From request to program to response
The server passes request information to a program, including environment variables and, when relevant, input data. The program produces output that the server returns as an HTTP response. The response can be HTML, an image, or another supported content type; CGI is not limited to webpages.
Is CGI a programming language?
No. CGI defines how the server and program communicate. Perl was associated with many early scripts, but other languages can implement CGI too. A .cgi filename tells you little about the language inside it, and the filename extension alone does not determine how the server handles a file.
Are CGI scripts the same as JavaScript?
No. CGI programs execute on the server. Browser JavaScript executes in the visitor’s browser, although JavaScript can also be used on servers. A page can use both: browser code might send a request that a server-side program processes.
Is CGI still used?
CGI is still supported by server software such as Apache. Classic CGI commonly starts a process for each request, which can become costly at scale; persistent application servers and FastCGI use different execution arrangements. Old downloadable scripts also need careful security review. Their age is a reason to examine them, not evidence that the interface has been deprecated.
What is cgi-bin?
A cgi-bin directory is a conventional location configured for CGI programs. The server configuration makes requests execute programs; merely naming a folder cgi-bin does not switch execution on.

