PDA

Click to See Complete Forum and Search --> : Perl .CGI not runnint on site


nino
Oct 6th, 2005, 07:45 PM
I have a perl .cgi located at:

www.javauk.com/cgi-bin/sitemodules.cgi

the contents of the file are:

#!/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:

-bash-2.05b$ which perl
/usr/local/bin/perl


i then ran the file from the cmd prmpt and got:


-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

visualAd
Oct 10th, 2005, 12:15 AM
What type of error do you get?

nino
Oct 11th, 2005, 06:36 AM
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, webmaster@fruitvalestudios.com 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

visualAd
Oct 11th, 2005, 06:56 AM
Is the script set to executble? Also, you may want to get rid of that blank line at the top of the script.

nino
Oct 11th, 2005, 08:32 AM
The blank line must have been how i pasted it in. I CHMOD the file to 755 but still no joy :(

Nino

visualAd
Oct 11th, 2005, 08:59 AM
Does the script work if you execute it from the command line? I.e:

# /full/path/to/script.cgi

Try renaming it to sitemodules too.

nino
Oct 11th, 2005, 11:40 AM
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

anotherVBnewbie
Oct 14th, 2005, 05:39 AM
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.

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.