Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 551
  • Last Modified:

500 error "Premature end of script headers"

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
sargento
Asked:
sargento
  • 4
  • 4
1 Solution
 
maneshrCommented:
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
 
sargentoAuthor Commented:
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
 
sargentoAuthor Commented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
maneshrCommented:
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
 
sargentoAuthor Commented:
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
 
maneshrCommented:
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
 
sargentoAuthor Commented:
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
 
maneshrCommented:
sargento,

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

Excellent!! Glad to know you got the solution you were looking for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now