Solved

perl / cgi: Internal Server Error

Posted on 2000-03-20
9
170 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
 

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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.…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now