The Path to Perl  

On a Linux or Unix machine, the first line of a file determines how it is handled when it is executed. This is also the case when using Apache for Windows. A Perl script must describe where to find Perl or it will cause an error.

Perhaps the fastest way to go about installing a Perl script is to try to install the script without modification. If you end up receiving a 500 Server Error after you have uploaded the program, it could be because the path to Perl is wrong.

If you have Telnet or SSH access to your server, you can try logging in with your Telnet client and typing which perl at the command prompt. This will tell you the path to Perl. If you don't have Telnet access, or you are unfamiliar with using it, most hosting companies have detailed documentation online which describes their path to Perl.

Because there are two paths to Perl which are used more often than others, another method is to simply guess the path. We've distributed our software with the most frequent path set, but trying the second most frequent path will fix a large number of 500 Server Errors.

To change the path to Perl, open up any .cgi files in the /exec/ directory in a text editor. Windows Notepad or Wordpad is acceptable. Change the top line of the file, without making any other changes. If you wanted to change the path to Perl to /usr/local/bin/perl (which is the second most frequent path), then you would change the first line of each .cgi file to

#!/usr/local/bin/perl

Most Windows Web Servers decide upon how to deal with files based on their extensions alone; therefore, this is not an issue if your Web Server is running on a Windows machine, as the line at the top of the script will be ignored. However, Apache for Windows does require the path to Perl. The first line will most often need to be set to

#!c:\perl\bin\perl