Solved

perl / cgi: Internal Server Error

Posted on 2000-03-20
9
173 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

830 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