CGI stands for Common Gateway Interface. It is not a programming language. A CGI is a way to communicate between a user somewhere on the internet and the web server. A CGI can be any executable on the web server. This executable can be a plain text script that's interpeted by Perl or it can be a stand alone binary.

When a user goes to a web site and clicks on "search" for example, this is a CGI. Lets say it's a Perl script. When the user puts in a word and clicks "search", a string of code is sent from the user's browser to the web site's server. The server see's a request for a script. This information is passed to that script. The script does its job and finds what it needs to find and returns the results to the user on the internet.

Note that this CGI may not be part of the web server program. It could be a seprate program that runs intirely on its own. CGI programming is entirely this passing of information back and forth.

CGI can be Perl, ASP (VB Script), C, C++, a UNIX Shell Script, or any executable.

Different ways to access your CGI

There are a few ways to access your CGI and different reasons for each one. The most basic way is to put in the full URL of the script, Perl, for example, in the address bar of your web browser. For example:

Or you can do the same, but with a few arguments:

Let's understand what that long URL means. What follows the ? starts the arguments. The first variable is "str1" with a value of "perl". The second variable is "str2" with a value of "script". The two sets of variables and values are separated by an "&". This method of sending variables along with the URL is usually done with a form so you do not have to type in that cryptic code.

Another method is to use "Server Side Includes". SSIs are used in SHTML pages. It must be enabled on your server. Usually it's enabled. The code is
<!--#exec cgi="/cgi-bin/myprog.cgi"-->

You simply insert that code where you want it to show up. Note that the exec cgi can be different depending on what server you are using. This example shows what would be used in Apache web server running on UNIX. SSIs are different from the other methods of CGI in that instead of generating an entire HTML page, it is only part of the page. It is "included" in the page.