Solved

perl / cgi: Internal Server Error

Posted on 2000-03-20
9
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

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 …
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…
Six Sigma Control Plans

617 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