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 cgi-lib.pl 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:

#!/usr/local/bin/perl

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

Hope you can help.
LVL 1
rhinosaurAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
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
#!/wwwroot/cgi-bin/perl.exe
though this may not work if it's on a different drive ..
0
 
rhinosaurAuthor Commented:
Edited text of question.
0
 
jhurstCommented:
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.
0
 
merryhillsCommented:
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.
0
All Courses

From novice to tech pro — start learning today.