Solved

500 error  "Premature end of script headers"

Posted on 2002-04-24
8
540 Views
Last Modified: 2008-02-01
I have a PERL script that is a CGI that I get a 500 error on if I try to access it thru the browser. If I run it from the command line it works! I looked at the error logs and it says "Premature end of script headers"..
Any ideas?
0
Comment
Question by:sargento
  • 4
  • 4
8 Comments
 
LVL 16

Expert Comment

by:maneshr
Comment Utility
sargento,

"..a PERL script th.."

Can you please post that Perl script here?

Meanwhile, i would suggest you ADD the following lines....

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


......AS the 2nd line of your code.

Let me know how it goes.
0
 

Author Comment

by:sargento
Comment Utility
THis is the test script i'm using:

#!/usr/bin/perl
$|++;
print "Content-type: text/html\n\n";


print "Hello World \n";

I'm sure that's the correct path for PERL.
0
 

Author Comment

by:sargento
Comment Utility
I just transfered over a domain to a new isp and I'm setting everything up. I tested cgi-bin just to see and I get the above error mentioned.
0
 
LVL 16

Expert Comment

by:maneshr
Comment Utility
sargento,

"..'m sure that's the correct path for PERL. ..."

How can you say that with certainty? Did you use the which command of UNIX to confirm the path?

".. I tested cgi-bin just to
                     see and I get the above error mentioned. ..."

Are you sure the permission on the file are ok? Are you certain that the cgi-bin directory in which you have the script is designated by the ISP as a CGI executable directory?

What is the output you get when you run the script from the command prompt?

Can you post the URL of the script that gives you this error?

Please provide as much more detail as you can.

This will help you get a more accurate answer, faster.

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:sargento
Comment Utility
I did a whereis perl for the path.
I get this from the command line:

Content-type: text/html

Hello World

Here is the URL:

http://www.capoeirasj.com/cgi-bin/test.pl

The public_html and the cgi-bin are virtual directories, if that makes a difference?

0
 
LVL 16

Accepted Solution

by:
maneshr earned 200 total points
Comment Utility
sargento,

"..I did a whereis perl for the path.
                     I get this from the command line:..."

From the command that you used & the output you get it looks that perl interpreter is in the right location and you can run/execute it too.

"..The public_html and the cgi-bin are virtual directories, .."

That should not make a difference. However, the cgi-bin directory needs to be configured so that it executes the script as a CGI program.

What web server are you using?What version of the web server are you using? What OS are you on?

Please let me know.
0
 

Author Comment

by:sargento
Comment Utility
It turned out to be a permissions problem. I don't know why because I set the permissions to 755 but something strange was going on the server side?
0
 
LVL 16

Expert Comment

by:maneshr
Comment Utility
sargento,

"..It turned out to be a permissions problem. I.."

Excellent!! Glad to know you got the solution you were looking for.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

11 Experts available now in Live!

Get 1:1 Help Now