Solved

500 error  "Premature end of script headers"

Posted on 2002-04-24
8
546 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
[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
  • 4
8 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 6967404
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
ID: 6967410
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
ID: 6967433
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
Technology Partners: 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!

 
LVL 16

Expert Comment

by:maneshr
ID: 6967487
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
 

Author Comment

by:sargento
ID: 6967898
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
ID: 6969099
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
ID: 6969465
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
ID: 6969519
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

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

717 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