For those who came late to CGI/Perl…

I do bugger all Perl. None in fact. So the last week was something of a learning experience.

Two of the corporate websites that I help maintain use FormMail from Matt’s Script Archive . FormMail is a general form handler that can email a user-submitted form from your website. We’ve had a few issues with it in the past, and this week I began to understand some of the whys and wherefores of how one goes about setting a Perl script up in your cgi-bin directory.

Before I go on, the host of our corporate site runs the very fine Zeus web server on Unix.

First tip when editing CGI - NEVER use an HTML editor. Use Notepad, or better still a product like EditPlus . If you use an HTML editor you will be doomed to an eternity of frustration because your script won’t run (see this great tutorial for details).

Dreamweaver 4 and FTP

If you use Dreamweaver 4 (as we do at work) for FTP-ing files to the site you need to be aware that there is a bug. CGI files must be uploaded as ASCII not binary. There is a file in Dreamweaver 4 called FTPExtensionMap.txt. This contains a list of file types and what method should be used when uploading them. Problem is, Dreamweaver 4 doesn’t honour the list. In order to correct this behaviour, patch Dreamweaver to 4.01 and those particular troubles are over.

Nearly there.

Once the file is uploaded, you must change the Unix permissions so that users can execute the file.

In Dreamweaver this is actually simple (as I’m sure it is in other FTP clients too).

1. Connect to the remote site in Dreamweaver
2. Click the cgi-bin folder on the remote site

3. Open the FTP log (Window > Site FTP log)
4. In the FTP log type: site chmod 777 (eg: site chmod 777 FormMail.cgi)
5. Happiness. You have now given all users access to the file

Read this chmod command/Linux security summary and go to table 3-9 for other code numbers (like 777).

Hopefully that will save some of you time one day!

Comments are closed.