Troubleshooting CGI Installations

Share this article

Having trouble installing that script? About 80% of the e-mails I receive all ask the same question: How do I install this script? It just isn’t working for me. I can’t say the following steps that should be taken before you upload the script are always going to work, but in the majority of cases, they do.

Step 1: What Format Are Your Files In?

If you run your site on a UNIX server, yet you do your script configurations in Windows, you will have to try and convert it to UNIX format. DOS, one of the main parts of the system in Windows PC’s, uses carriage returns and line feeds to terminate text file lines. UNIX on the other hand, only uses a line feed.

Basically if a Perl program is in DOS format, it will crash and not run on a Unix sytem. If you are compiling a C program, it will not compile correctly at all. Uploading in ASCII format will eliminate this problem.

Step 2: Did You Set The Path To Perl Correctly?

Most servers have Perl located in either of the following locations:

#!/usr/bin/perl

or

#!/usr/local/bin/perl

If those locations are not correct, try typing “which perl” from the telnet prompt, if you have access to it. Otherwise, contact your systems administrator. If you are wondering what the #! is before the location, that is the “shebang line,” or the line that notifies the server that the file requires it to be run by Perl, and the location of Perl.

Step 3: Did You Uncompress The File Properly?

A visitor to TheScripts.com pointed this one out to me:

After you download a script, if it was compressed in TAR mode, you will have to uncompress it correctly. All Windows users should remember that WinZip defaults at the option “Tar Smart CR/LF,” under the options/configuration/miscellaneous section. Disable this. When enabled, it will uncompress incorrectly.

Step 4: Be Careful When Editing Configuration Files

If a script requires you to edit your configuration files, be extremely careful with what you do. Most people that experience installation problems either uploaded in binary mode, or messed up the configuration files.

Remember to follow the author’s directions exactly, as even missing a bracket will screw up the whole script. Insert your variables or whatever you need to edit where told, and only there. The format should also be kept the same.

Step 5: Set Your File Permissions Correctly

All CGI programs require you to set their permissions correctly in order to run properly. Therefore, they must be set at the permission “755.” This is the permission for an executable file. People that FTP into their servers can easily use their FTP programs to set the permissions. Usually, this is just a right click on whatever file is in question. Telnet users have to telnet into their server, go to the directory the CGI file is in, and type in the prompt “chmod 755 filename.pl”.

Some files require different permissions. The author will state to you what those permissions have to be.

When All Else Fails

If you are still having troubles with the script, try running it from telnet if you can. The errors will be listed there. If you can’t or don’t know how to correct the errors, you have several options as listed below :

  1. Contact the author
  2. Use the tutorials found at TheSripts.com
  3. Try the help forums; we are more than happy to help you with your problems: http://www.thescripts.com/cgi-bin/Ultimate.cgi

I hope this helps you all, as it works about 80% of the time.

Blair IrelandBlair Ireland
View Author

Brad writes TheScripts.com where you can learn about MySQL, PERL, PHP and more. You'll find an index of over a thousand freely distributed scripts that you can use to enhance your Website.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week