CGI (Common Gateway Interface)

Tags: CGICGI scriptsmod_cgi

Published on: October 13, 2014 by George K.

CGI (Common Gateway Interface)


Common Gateway Interface (CGI) is a technique used in web servers for generating dynamic content using other application programs. Web servers are not capable of generating dynamic content. They are programmed just to deliver the requested static page. CGI provides a way of passing data/request to other applications and receive response. When a user requests for a dynamic content the web server receives the request and pass it to the appropriate application using CGI. The application program processes the request and generates a response and pass it to the web server using CGI. The result is sent to the user by the web server in HTML form. The CGI application may be running in the same server or in another application server. Let us more about the apache CGI module


mod_cgi is the Apache CGI module responsible for handling requests for CGI execution. It handles all files with mime-type set to application/x-httpd-cgi or handler associated to CGI-script. There are two types of programs that are executed by CGI : scripts and compiled programs. Scripts are those programs written in scripting language and can be executed directly by server without any compilation. Usually scripts are used for small programs. They are easy to debug and maintain. Second type of programs are compiled binary executables which are used for heavy applications. Compiled executables runs faster than scripts.

CGI programs are identified by their extension associated to CGI script or by ‘ScriptAlias’ directive in httpd.conf file specifying one or more directories as CGI directories (usually ‘cgi-bin’). Whenever a request comes for the files in CGI directory or CGI type file, it is executed and the output is sent to the requested client.


Get 24/7 expert server management

Category : Apache, General, Linux, Training

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:


Add new commentSIGN IN

Let's Connect


Your Cart

Cart is empty.

Send this to a friend