Solved

500 error  "Premature end of script headers"

Posted on 2002-04-24
8
543 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
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

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…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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