Voltar's Newbie Webmaster Resource


CGI Basic tutorial


by aleck
this tutorial was made for Voltar's Newbie Webmaster Resources,
it's copyrighted by aleck and can be used only at VNWR

we will speak about proper installation of cgi-scripts, i've heard that this is rather complex for most ppl

okay, 1st thing we should take care about is proper unzipping, usually scripts come in zip-packages, open 'em in WinZip for Windows9x/NT that supports long filenames, check all filenames and folder names (no filenames like longfi~1.dat should appear)

2nd step, rather complex sometimes is to set all variables as mentioned in script's manual
usually most problem comes with full path to script. if u have telnet access to ur server (usually that's true for serious hosting providers) log in and type 'pwd' u will receive full path to ur home folder (smth like /usr/web/users/thatdude/) in most cases add /domainname/cgi-bin/scriptname/ to that path and will be ok, but u can always ask ur system administrator, it will take exactly 2 seconds to type an answer in icq window and press Alt-S :-)

next step is uploading, make sure u r using ASCII mode for all cgi files (same for .pm, .txt. usually all files in cgi-package r in text format, but data files (.dat) can be in binary one (check script's manual to find out this). graphic files like .jpg, .gif & .png always r in binary mode, archives .zip, .gz - too)

very important step, 90% of all problems r here. set proper permissions. usually manual gives u full information about this, but keep in mind that all cgi scripts should have 755 mode, data files 666 and folders 777. this will work in 99.5% of cases.
to set permissions u can use telnet and 'chmod' shell command, but i recommend to use FTP client that can set chmod from remote system without telnet logon at all. CuteFTP and FAR built-in FTP client do it ok.

final step. make sure u have done all above steps properly. if ur script has an install feature with autocheck feature - very good, u can make sure that everything is ok.

now some common problems:
500 server error: two possible reasons - script was uploaded in binary mode or u've screwed permissions. please note that sometimes this error can appear due to improper error handling in the script, like wrong setup, etc. so keep in mind that 500 error is rather common, but always make sure that script was uploaded in ASCII mode and proper permissions were set
various script error messages - check script manual for this

this will help u to save money on doctors :)
hope the word "cgi" won't lead to a headache to often lol
good luck,
aleck

Written and contributed
by aleck


Back To VNWR