Gossamer Forum
Home : General : Perl Programming :

Internal server error

Quote Reply
Internal server error
hello all

I have a problem getting my scripts to work on my server

and i wondered if i could post a test script here and see if anyone could pick

any reasons why i keep getting internal server errors...

here goes

Code:
#! /usr/bin/perlprint "Content-type: text/html\n\n";
print "<html><head><title>Test for cgi</title></head>";
print "<body>"
print "Hello world";
print "</body></html>";


Is it the white space after #!

i am confused..

thanks

steve

Last edited by:

ferdymania: Jun 5, 2003, 4:49 PM
Quote Reply
Re: [ferdymania] Internal server error In reply to
Does your test script actually look the way you posted it? (just covering all bases...) There should be no space before or after #!, and nothing after the path to Perl except command line options. Your actual code should begin at line 2.

Aside from that, the most common reasons for ISS are incorrect Perl paths and permissions.

Philip
------------------
Limecat is not pleased.

Last edited by:

fuzzy thoughts: Jun 5, 2003, 5:17 PM
Quote Reply
Re: [fuzzy thoughts] Internal server error In reply to
hi fuzzy

and thanks for replying.. No I did not have a space before or after the #! thingy..

And i checked and checked the Ascii upload mode and the 755 chmod business..

and the perl path is correct.. ???

time and time again i checked all above, but no go... it is a mystery to me..

i only wanted to teach a student some cgi stuff but its all looking pear shaped ...

I tried a php script and that worked lovely..

i might go with some php...

I never had this problem with perl before...????

Thanks again fuzzy

steve
Quote Reply
Re: [ferdymania] Internal server error In reply to
Try reading your error log or do:

perl -cw script.cgi

...from ssh.

Last edited by:

Paul: Jun 6, 2003, 7:44 AM
Quote Reply
Re: [ferdymania] Internal server error In reply to
If you want to send over an email/PM to me, then I'd be happy to have a look for you. Probably something simple. A new pair of eyes normally helps :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Internal server error In reply to
hi

here is the error log..

failed to open log file
fopen: Permission denied
[Thu Jun 5 16:53:35 2003] [error] [client ....] Premature end of script headers: /........./cgi-bin/test4.cgi

And here is the script...

i dont get it...

Code:
#!/usr/bin/perlprint "Content-type: text/html\n\n";
print "<html><head><title>Test for cgi</title></head>";
print "<body>"
print "Hello world";
print "</body></html>";


thanks y'all .. cant see nothing wrong with that ..

steve
Quote Reply
Re: [ferdymania] Internal server error In reply to
You need to have the page header line on a separate line as alluded to by others:

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head><title>Test for cgi</title></head>";
print "<body>"
print "Hello world";
print "</body></html>";
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Jun 6, 2003, 8:20 PM
Quote Reply
Re: [Stealth] Internal server error In reply to
He already said that the old format was just a forum typo. In the real one, he has no space at the beginning, and his content-type tag is on the line below.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Internal server error In reply to
i did it just how stealth has typed it.. its a forum typo..

seems like a "premature end of script header" error... I am trying to track where that exactly is..

thanks for the input...

steve
Quote Reply
Re: [ferdymania] Internal server error In reply to
Either the ownership of your script is wrong, the chmoding is wrong, or the chomdding of the directory it is in is wrong...or maybe the perl path is wrong....or you uploaded in binary instead of ascii....or you have some linefeeds in the script.
Quote Reply
Internal server error In reply to
I used my Plesk filemanager to create a new file and wrote a test script in that..

i used #!/usr/bin/perl -wT

and used newline characters (\n) at the end of each print statement

e.g

print "<h1>Test perl</h1>\n";

and it worked.. i suspect that there has been a linefeed problem..

i dont know why.. some sorta unix/windows linefeed transgression thingy....

i guess i will have to write my stuff inside the plesk filemanager from now on...

weird.... i have learnt a lot though...

thanks for all the kind replies .. you are all lovely people...

steve XXXXXXX