Perl CGI: Cannot be displayed

Can you tell me why I can't get a simple Perl5 CGI program that is placed in the cgi-bin directory of my Personal Web Server to work. I have installed Perl5. Incidentally, the CGI script has a standard windows default icon and is just called "CGI File" - is it set up correctly? I have the file placed in this directory too with a yellow icon (i.e. it's recognised as a perl file). Although the simple CGI doesn't use this file. If I rename the .CGI to .PL then it tries to download. Normally it comes up with HTTP 500 Internal Server Error - problem with page you are trying to reach.

I have a feeling it's somethingto do with the first line:


as the file has been placed in "wwwroot/cgi-bin".

Hope you can help.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

s_stirleyConnect With a Mentor Commented:
The first line is to pass the script to the perl program. You need to change it to something like
though this may not work if it's on a different drive ..
rhinosaurAuthor Commented:
Edited text of question.
I doubt that the problem is that first line.  The line does need to be the address of the perl interpretter, that is true, but if you can make the thing execute other ways then the line must be right.  Check that you can execute it.

The check that the script really does the Content-type: header and all the required <html>, etc.
1. Check that perl executable is in /usr/bin/perl

2. Check that the permisiions of the cgi script are correct, it needs to allow execution,
eg chmod 755 script.cgi

3. Check with your ISP that you have permission set in the web server to run cgi scripts in your directory, only the administrator can do this. If you are running an apache web server you need to edit the .httpconf file. Near the end of this file it allows you to specify the access permissions for directories running cgi-scripts

4. Check the administrator error logs, usually found in /var/log/httpd.error, they tell you whats going on.
All Courses

From novice to tech pro — start learning today.