< back


note: all links in text on this page open another browser window.

eh! What's a cgi-bin? Who is CGI when he's home?

No doubt noticed on web sites are forms (<form>.....</form>), a series of text and selection boxes one selects or fills out and submits to the webmaster. They may be for contact feedback, forum entries, page level password access, adding URLs to link lists, Guestbook entries, and so forth. Here is my site Feedback Form, and it uses my globally popular free-to-use "ennyForms" form processing CGI program.

The most common and versatile methods of form activity are from the browser, via a servers Common Gateway Interface, to a server side (on the server) program written and installed ready to recognise submitted data from a particular form and of course do something with that data.

Simply, as a "gate way" the CGInterface makes available to any server side program certain information about its environment (the servers), plus data relayed to that server via the source server calling the program (visitors ISP), which in turn is passing data from a visitors browser!.

Fun huh?... at first it all sounds a bit howsyafather. You will in time come across a lot of reference to this stuff as a webmaster so you might as well get used to it now.

In the future once you have CGI forms on your own site you have a truly interactive web site.... feedback contact as above, polls, forums, guestbooks obtained here, classified advertising, payment forms and shopping carts, email list subscribing and web based mail list merging ie newsletters, site "referring to friends" promos, etc.

Note: You will find more info on creating form objects via the HTML Code Lab.

Note: A CGI-BIN may not be named the same on some servers but similar (cgi-local, cgi, etc).

Well, these "cgi-bin"s are very special areas (actually URL accessed as a sub directory of your sites root directory although it may not exist there) and it is the task of the server - if properly set-up by the technicians - to protect all files within the cgi-bin area including sub directories, and only allow execution of certain file types within.

The idea is that only programs run (executed) within the cgi-bin have access to any other files within which we can call program auxiliary files. ie a CGI Guestbook program will save new entry data to a special file and alternatively access the records in the data file to display them as an html page. I suspect you have all seen the "Add to my Guestbook" and "View my Guestbook" links on many sites (my popular free-to-use "VizBook" Perl Unix CGI program is one of the webs more versatile guestbook programs ready for you when you have your own site).

Simplified, that is the process followed for any form processing - where the visitor "Submits" form input to the server for whatever purpose... ie the browser actually submits the web page form data to the server side CGI program, and the CGI program is expecting that forms data and does something with it (there are other more complex CGI processes but described is by far the most common).

So if you obtain your own proper hosted web site and domain name you will most likely find a "cgi-bin" (or similar) sub directory already created for you. You DO NOT play with that directory name OR place normal web pages and web page images in it.

Note: When obtaining a web site, ask, is there a cgi-bin where I can install CGI programs?

Eventually you may progress to having a go installing some readily available simple perl CGI programs and learn how to do that. There is quite a bit to learn. Files MUST be properly FTP uploaded, and almost exclusively as ASCII Text, and you must learn about file "permissions" and a few other bits and pieces often peculiar to specific servers. Or if preferred or no time to bother you can hire somebody like myself to do a low cost professional installation (via one of my own relevant site links) of your selected program found at the many perl cgi program (Perl scripts) indexing sites.

Lastly, already mentioned and described below and by far the most commonly available type of CGI programs are "perl" programs. Also referred to as "scripts" they are "open source" programs written in text format using the "Perl" programming language.

I repeat because of it's importance and relationship with the server, the cgi-bin or similar name as set by the host is a very special area of a web site and is not for playing with; if not used just leave it alone.

*And for the future remember contrary to what many programming? "kids" suggest, or don't, with their available programs ALL CGI programs should be run from and save to the CGI-BIN.

Given access by the host company to such a delicate part of a server through your site, a server which is part of a connected global "network" of computers, you take on responsabilities NOT to be treated lightly - especially concerning security.

Even if not installed by you, a true FTP program and the ability to use it correctly is required to manipulate / update auxiliary files relating to CGI programs. See the section on FTP in the "How the heck do I UPLOAD / Manage my site" page.

As you can see by links on this page I offer a popular range of free-to-use common program types to assist webmasters in addition to these tutorials so book mark dtp-aus.com for future CGI perl program script reference. If your site is CGI enabled and you need assistance you can apply for low cost installations.

Perl Scripts - someone referred to Perl as the glue that holds the Internet together
Perl is one of the computer languages which uses un-compiled "programs"; ie programs are in text format and can be "read" easily by humans - albeit you probably won't know what it all means.

Because Perl is an open source programming language many think
1) it is a poor substitute as a computer language,
2) it easy to create proper network secure programs

Nothing is further from the truth.

Computer languages like Perl and the common very fast C++ are all written in similar text format.

True - it's just that languages like C++ have to be pre-compiled to a Binary executable with specs relating only to that type of computer they are to run on (or compiled for each different!).

Compiled programs are programs which when written are then turned in to "Binary Executable" programs, saved to hard disk, and are ready to run as is (easily recognised "???.exe" files on a PC are compiled binary programs).

Perl scripts on the other hand are compiled by the "Perl Interpreter" each time the program is called; that is the text based script is parsed (read) by the interpreter and compiled in to memory each time called and then executed from computer memory just as any other program).

"Run-time" compilers (acka Perl) compile the program within specs set-up on the computer (server!) at the time of each invocation.

So ideally perl scripts should reside in the CGI-BIN from where they can be securely executed, AND where a given programs info and saved data files can be stored securely also (so long as the cgi-bin is correctly protected by the server OS - weaknesses in the programming excepted).

Perl began its life way back as a powerful but simple readily accessible quick and dirty scripted language for Unix Main Frames; easily accessed by the techos managing them. The guy who started it all, Larry Walls, is still involved in continuing development which is also open sourced (the actual "Perl interpreter" bits and pieces) with contributions made by many around the world.

PS: should you want to dabble in Perl one day; without the need for compilers etc many do...
Network programming is 10% making the program work, 90% fixing it to do and accept ONLY what it is supposed to!

As opposed to simpler "local" computer programming and because it is off on a completely different tangent that extra 90% takes a lot of learning and experience to achieve reliable results. Respect that salient thought and be humble in your endeavours.

< back

Over 120 pages: All major topics divided into Classrooms
Free Backgrounds & Buttons! DTP and HTML "My First Page" HTML lessons
Tutorial Text Search Perl CGI Scripts Typography & Layout
4 pages of Links Visitors Book Perl Scripts Forum n/a
Free Links page Feedback Form Q/A contact Forum

pages Designed & Published - Ron F Woolley
e-mail 1997 '98. Last Revised:  Friday, 31 October 2003 22:04