您的位置:寻梦网首页编程乐园CGI编程Zhanshou's CGI Tutorial

CGI Programming Languages


Because CGI is a "common interface". CGI applications can be written in any language that can be executed on Web servers, either compiled or interpreted. These languages may include PERL, C/C++, Shell Scripts, Visual Basic, FORTRAN, etc. Which language is better in a particular environment depends upon many factors including systems and servers.

CGI first appeared on UNIX-based systems. The most popular Web servers are NCSA httpd server and CERN httpd server. PERL was first designed as an UNIX system script language. Its ease of use and strong pattern-matching and string-manipulation properties have made it very popular as a CGI programming language. C and Shell Scripts (C Shell, Bourn Shell or Korn shell) are also very popular in UNIX-based servers.

With Window NT's rapidly growing acceptance, more and more Window-based servers are entering our lives. The most popular servers are Website , Netscape Enterprise Server and Microsoft Internet Information Server. UNIX-born PERL, which was adapted for the Windows NT platform, is still one of the most popular CGI programming languages.

Visual Basic is also very popular in Windows CGI programming. One reason is that Visual Basic has the largest number of users among all the programming languages in the world. Another reason is that Visual Basic is easy to learn and use. So Visual Basic will play an important role in the future in Windows CGI programming.

C is also a very good programming language for CGI. It is suitable for any platform.

Probably you may ask which language you should use. My suggestion is to use the language that you know best. If you only know Visual Basic and you do not want to learn the somewhat annoying C or PERL languages, that's fine. If you only like C, you still can do anything you want. But if you want to become a real CGI programmer, I still suggest you learn PERL. If you have any programming experience, you'll find PERL is pretty easy to learn. If you need one year to master the C language, I think one month is enough for PERL. In this tutorial I will talk more on using PERL script.

Ok, now we know C, PERL, Shell Script and Visual Baisc are good stuff for CGI. Then how about Java, Javascript, VBscript or ActiveX Control technology? How do they work for CGI? The answer should be that these languages will probably work fairly well but since they are so new, the "jury is still out" on most of them.

Actually, Java, ActiveX control, JavaScript and VBscript can be executed on the client directly, not like CGI in which the client's request is first sent to the server, the server executes the program and then sends the output back to client.) This means that they can do the same job as the other languages with CGI can do. This is why these languages are becoming more and more popular.

The recent popularities of Java may have given you the idea that you should study Java or similar languages instead of CGI. This is not complete true. Java , ActiveX are pretty new techniques. They are indeed very attactive (I spent a lot of time playing with them) but they have a lot of limitations and do not yet provide all the functionality of traditional CGI. So knowing how CGI works is still very useful.


Previous Page Table of Content Next Page