Web Hosting

What is Common Gateway Interface

The Common Gateway Interface, or CGI, is a standard to specify a data format that servers, browsers, and programs must use to exchange information. A program written in any language that uses this standard to transfer data between a Web server and a client’s browser is a CGI script. In other words, a CGI script is an external gateway program to interface with information servers such as HTTP or Web servers and client browsers.

CGI scripts are significant in that they allow the web servers to be dynamic and interactive with the client browser as the server receives and accepts user inputs and responds to them in a measured and relevant way to satisfy the user. Without CGI, the information the users would get from an information server would not be packaged based on the request but based on how it is stored on the server.


CGI programs are of two types: those written in programming languages such as C/C++ and Fortran that can be compiled to produce an executable module stored on the server, and scripts written in scripting languages such as PERL, Java and Unix shell. For these CGI scripts, no associated source code needs to be stored by the information server as is the case in CGI programs.

CGI scripts written in scripting languages have not complied like those in non-scripting languages. Instead, they are text code which is interpreted by the interpreter on the information server or in the browser and run right away. The advantage to this is you can copy your script with little or no changes to any machine with the same interpreter, and it will run. Also, the scripts are easier to debug, modify, and maintain than a typical compiled program.

Both CGI programs or scripts, when executed at the information server, help organise information for both the server and the client. For example, the server may want to retrieve information entered by the visitors and use it to package a suitable output for the clients. In additional GCI may be used to dynamically set field descriptions on a form and in real-time inform the user on what data has been entered and yet to be entered.

In the end, the form may even be returned to the user for proofreading before it is submitted. CGI scripts go beyond dynamic form filling to automating a broad range of services in search engines and directories and taking on mundane jobs such as making the download available, granting access rights to users, and order confirmation.


As we pointed out earlier, CGI scripts can be written in any programming language that an information server can execute. Many of these languages include script languages such as Pert, JavaScript, TCL, AppleScript, Unix Shell, VB Script, and nonscript languages such as C/C++, Fortran and Visual Basic. There is dynamism in the languages themselves so that we might have new languages in the future.

Show More
Back to top button