CGI Tutorials

Configuring CGI Scripts

Do you want to install a cool new CGI script in your cgi-bin? CGIs make really cool things for websites.

 If you want your homepage to be more visitor interactive, you don't want to have to confirm everything or constantly update, CGI can help.

There are many places to get CGI scripts for free, demo, or a reasonable price, like at http://www.cgi-resources.com.

Once you've chosen a script you would like to use, download the file to a folder you'll remember. Most are in ZIP format to start, so you'll need to unzip the script using WinZip or another program of the such. Now, open the ReadMe file, if there is one, or the script itself, in an editor such as Notepad, wordpad, or an HTML editor like CuteHTML or FrontPage.

The readme.txt should explain exactly what everything in the script is asking you to do. The first thing you must do for every script is to know your server's configuration info., such as where your site is located on the server, where perl is located, or your send mail program, etc.

For most people, /usr/bin/perl is where perl is located on the server, and you have to configure this is the first line of every script. You have to make sure of your server's though, for the script to work properly. Then find out where your CGI-bin is, like, for mine, it is at: /kryss.net/cgi-bin/, but for your domain, it might be something completely different. If you don't know how to find this information on your own, try looking in the FAQ on the site of your ISP, e-mailing your ISP, or downloading a script that tells you this info! Some of the script is basic HTML that you can easily configure; some parts, for copyrights, say "don't edit." For these parts, you can try to get rid of the copyright or edit it to be your own, because the person who distributes the script will most likely never see it and there really is little he can do about it! But sometimes you will delete something important by mistake, and so you really have to be careful.

It's best to leave these "non-editable" parts as they are, to be safe, unless you're as greedy as I am! Some scripts you must edit completely with this info. in the script; others you edit a little then upload and use a control panel. Either way, you must have an FTP program, such as CuteFTP (my program) you can use to upload the script.

After you upload everything as directed (most of the time, you'll want to make a new folder for it, but make sure to put CGI things in the cgi-bin and other things outside of it), making sure to upload CGIs in ASCII mode and other things in Binary (default) mode, you have to do something called CHMODing the script.

Most of the time, the ReadMe will tell you what you need to CHMOD specific scripts or files. For most CGI scripts themselves, it is usually 755. In CuteFTP, or any other FTP client, right click (or find it another way) the file and enter 755 in the text box, then press "CHMOD" or the such. Do this after the file is uploaded in your FTP program. For non-cgi scripts, it's usually 777.

But make sure to read the script's specific info. before doing these defaults, or the script may malfunction and not work properly, or you may be given an "internal server error" sign. Careful on this!

Each script is different, and what you must configure very specific, but it is easy to configure your CGI script and make it work properly.

Remember to CHMOD it again after re-uploading with edits in the correct mode, or minor mistakes shall result and your whole thing won't work right. For form processing, guestbooks, counters, and just about anything else you can think of, you must use CGI. Programming it is complicated, but hopefully now you will have learned to configure your script properly to work well! Good luck with your future CGIs!

Kryss' Index

[../footer.htm]