Solved

perl / cgi: Internal Server Error

Posted on 2000-03-20
9
172 Views
Last Modified: 2010-03-05
I get an Internal Server Error when I run my perl script through a link on a html-page. It works fine on command line. What could be the problem and is there a way of getting more information of the error - not only Internal Server ... bla bla?

Here's the head of my perl script - if it helps:

#!/usr/local/bin/perl

use strict;
use HTML::Entities;
0
Comment
Question by:Stapman
  • 4
  • 3
  • 2
9 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2637148
do you have a content-type header ??

if not you need to add the following line before you print ANYTHING to the standard output.

print "Content-type: text/html\n\n";

Also can you post  the entire code as it would help to identify the exact problem.??
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2637149
do you have a content-type header ??

if not you need to add the following line before you print ANYTHING to the standard output.

print "Content-type: text/html\n\n";

Also can you post  the entire code as it would help to identify the exact problem.??
0
 
LVL 1

Expert Comment

by:lambda
ID: 2638885
U can get the details of the error from ur errorlog.
But if it works fine on command line, it has to be the Content-type, as  maneshr says.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:Stapman
ID: 2640123
Is it a must to put the line "print Content-type..." into your script? I have another script where the "Content-type"-line doesn't exist and I do not get an error message.

How do I use my errorlog (even though it won't help me in this matter - it is good to know...) to get the details of my error.

Is there another possibility? Does it matter if the "print Content..."-line is under the use strict; etc. or must it be above?

My script is very large - that's why I didn't post it.

Thanks for your help....
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2640161
the Content type mime header IS required if you want to show any output on your browser.
typically server error logs do indicate this kind of error, but with a rather cryptic message. (the script did not produce a valid header or something to that effect).

i would suggest you try adding the Content type line. after all its just one extra line. if that does help solve your problem, thats it. if not we can then look at other possibilites.

0
 

Author Comment

by:Stapman
ID: 2640224
I inserted the 'print "Content-type..."'-line and still get the 500 Internal Server Erorr. It is said that "The server encountered an internal error or misconfiguration and was unable to complete your request". If there isn't an internal error - over the command line there wasn't an error and I added the Content-type-line - the problem is a misconfiguration?! What exactly could that be?
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2640288
ok not try this. Execute the script from the command prompt.

if the script executes properly (either by showing some output on the screen and then returning to the prompt OR just returning to the prompt or if you are using the CGI.pm module, shows "(offline mode: enter name=value pairs on standard input)") then there is no sytax problem with the script.

if not you might have to provide this forum with the code or at least the main parts of it.

Also check your server error log for any hints.
0
 
LVL 1

Accepted Solution

by:
lambda earned 50 total points
ID: 2640651

Another problem could be that ur perl is located at a different location.
It might not be at "/usr/local/bin/perl".  Please verify that.

Please try running an ordinary script which prints something to the browser.
0
 

Author Comment

by:Stapman
ID: 2641096
That was the problem!
I was looking for quite some time and finally found it myself. Next time I'll check what lambda says faster to save some nerves & time.

Thanks to you all....
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
iSeries PERL Scripts 7 157
.properties file to call function/method 9 61
Edit Odbc.ini using perl module 2 83
Perl script to find new files and compress those new files 5 94
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question