As mentioned, CGI programs can be written for a variety of different OS and Web Server combinations in a variety of languages. Because Unix, Apache, and Perl are all so popular for Internet infrastructure, this is the most common combination for writing CGI programs, but it is by no means the only environment.
Languages that can be used for CGI include: Bourne shell, C shell, Korn Shell, C, C++, Python and of course Perl. While many languages can be used to write CGI programs, not all of them are as well suited to the task as others.
Shell programs (Bourne, C, and Korn) tend to suffer from poor performance, and are more difficult to secure. They also tend to be worse at string handling, which is a major component of CGI programming. Few example programs and programming libraries are published for CGI shell programming.
C and C++ can have high performance, and can be secure. However, they are less adept at string manipulation, and the compile / link process can slow down development compared to interpreted languages. Some CGI programming libraries and example programs are available, but less so than Perl or Python.
Python is an object oriented scripting language that is well suited for CGI. It was originally written as an object oriented language, where as Perl's object orientation features were added after the fact. Because of this, some people feel that Python is a better object oriented language than Perl. Python also tends to have cleaner less confusing syntax than Perl. Python has a good variety of programming libraries and example code available. Python's main disadvantage compared with Perl is that it is less commonly known and used than Perl. This makes expertise, support and example code harder to come by.
Perl is the most common language for CGI programming. Like Python, it is interpreted rather than compiled, which can make for more rapid development than C and C++. Its string handling is excellent. It has a wide variety of programming libraries and example code available, and because it is so commonly used, expertise and support is easy to come by.
Because CGI was one of the first dynamic content methods, and because it is so popular, most every web server supports CGI programs. This includes Apache, Microsoft IIS, and Netscape/iPlanet servers. Porting CGI programs from one web server to another is not difficult unless the OS platform is also changing. Changing the OS platform may or may not complicate the process, depending on the language support on the new platform and the features used by the program.
Because all the most common web servers can run CGI, any platform that supports those servers can run CGI programs. Both Apache and Perl are available on nearly every platform, so because of this, Perl CGI programs can be run on Unix, NT, MacOS, OS/400 and even VMS.
Copyright 2001 - Andy Welter