Solved

perl / cgi: Internal Server Error

Posted on 2000-03-20
9
174 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Uploading Binary Data using Perl 5 106
Perl Scripting from a shell script with if and for 4 88
Problem with one substitution modifying another 3 84
Perl Awk Need Help 3 150
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

751 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