Perl .CGI not runnint on site
I have a perl .cgi located at:
www.javauk.com/cgi-bin/sitemodules.cgi
the contents of the file are:
Code:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<font size = 10 color = red> <b>COM328J1</B> </font color><br>";
print "<font size = 10 color = green><i>COM347J1</i> </font color><br>";
print "<font size = 10 color = blue>COM409J1 </font color><br>";
print "<font size = 10 color = yellow>COM411J1</font color><br>";
print "<font size = 10 color = black>COM332J2 </font color><br>";
print "<font size = 10 color = cyan>COM333J2 </font color><br>";
print "<font size = 10 color = brown>COM340J2 </font color><br>";
print "<font size = 10 color = pink>COM374J2 </font color><br>";
I have accessed the server via telnet/shh and typed Which perl to find the path and i got:
Quote:
-bash-2.05b$ which perl
/usr/local/bin/perl
i then ran the file from the cmd prmpt and got:
Quote:
-bash-2.05b$ perl sitemodules.cgi
Content-type: text/html
<font size = 10 color = red> <b>COM328J1</B> </font color><br><font size = 10 color = green><i>COM347J1</i> </font color><br><font size = 10 color = blue>COM409J1 </font color><br><font size = 10 color = yellow>COM411J1</font color><br><font size = 10 color = black>COM332J2 </font color><br><font size = 10 color = cyan>COM333J2 </font color><br><font size = 10 color = brown>COM340J2 </font color><br><font size = 10 color = pink>COM374J2 </font color><br>
The problem is when i try and run the file from the browser i get an error
any ideas?
Thanks
Nino
Re: Perl .CGI not runnint on site
What type of error do you get?
Re: Perl .CGI not runnint on site
The page title says
"500 internal Server Error"
and the body:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Thanks for any help :D
Nino
Re: Perl .CGI not runnint on site
Is the script set to executble? Also, you may want to get rid of that blank line at the top of the script.
Re: Perl .CGI not runnint on site
The blank line must have been how i pasted it in. I CHMOD the file to 755 but still no joy :(
Nino
Re: Perl .CGI not runnint on site
Does the script work if you execute it from the command line? I.e:
Code:
# /full/path/to/script.cgi
Try renaming it to sitemodules too.
Re: Perl .CGI not runnint on site
i got the SSH logons and comiled the file from commandline thing with no problems. and also executed it via SSH with no problems, tis white strange problem
Re: Perl .CGI not runnint on site
Try for the simple stuff..pico the perl script. i.e. "pico -w sitemodules.cgi" - when pico opens the script make any change (I normally just hit enter and then backspace) so that pico will allow you to save the updated file and try it again...Lynux servers especially have a tendancy not to allow the script to be executed unless it was written on the server.
The other thing to try would be "perl -c sitemodules.cgi" and see if any errors are reported.
And just a little fyi here, you might want to look at using perls quoted print when printing multiple lines, especially of html. i.e.
Code:
print qq~
put all of your html here in as many lines
as deisred and formatted as desired and then close it with
~;
as that not only eliminates having to say print repeatedly but it will also cause perl to automatically ignore any special characters, such as ampersands, that will cause perl printing problems.