Forum Moderators: coopster & phranque

Message Too Old, No Replies

Premature end of script headers

I want to die

         

fidibidabah

7:12 pm on Sep 21, 2004 (gmt 0)

10+ Year Member



Soooooooo frustrating.

I'm configing formmail. FormMail has worked for like 829592348 million people. CHMOD is 755, it's in my cgi-bin...

But this happens when I try to submit. Er, well I get a server 500 error, but my log says:

[Tue Sep 21 15:08:38 2004] [error] [client **.***.***.***] Premature end of script headers: /home/*/public_html/*/cgi-bin/FormMail.pl

Any ideas?

tombola

8:01 pm on Sep 21, 2004 (gmt 0)

10+ Year Member



Make sure that the path to sendmail is correct.

Also: did you upload the script in ASCII format?...

fidibidabah

9:16 pm on Sep 21, 2004 (gmt 0)

10+ Year Member



Yes and yes, I don't know what else to do without posting specifics, and I can't do that :(

If it helps at all, this particular script is being run in a subdomain of my site, which is redirected.

For instance, if the domain was www.banana.com, the subdomain would be long.banana.com, and the info for the subdomain would be located in www.banana.com/long, also, there is a masked redirect from www.long-banana.com.

So, the actual place of the file is in like banana.com/long/cgi-bin/SendMail.pl, but is being accessed from www.long-banana.com/cgi-bin/SendMail.pl

Matt Probert

5:13 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you edited the script on a DOS/Windows computer? The text file format is different to Unix. If you upload in ascii mode using the command line FTP then the file will be correctly converted for you, some other FTP clients may not.

If you still have no joy, try editing it under Unix and saving it. That might help.

Matt

ArmedGeek

10:51 pm on Sep 24, 2004 (gmt 0)

10+ Year Member



Sometimes you will get that error if the script throws an error. Try executing the script from the commandline and see if it throws an error. 99.732% of the 'Premature end of script headers' errors I've had have been resolved this way.

MichaelBluejay

1:07 am on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Put this at the very top, after the shebang line:

-------------
print "Content-type: text/html\n\n";
print "No boo boo!";
exit;
-------------

If that doesn't print then you have a permissions problem or some kind of problem with the file. If it DOES work then the problem is somewhere in your script. Move that group of three lines farther down in the file and then try to run the script. Keep repeating, moving the three lines farther and farther down in the script until you get the error. Then you'll know where the error is.

upside

1:15 am on Sep 29, 2004 (gmt 0)

10+ Year Member



ArmedGeek's suggestion is a good one. You could also try enabling warnings and using Carp to trap the errors like so:


#!/usr/bin/perl -w
use strict;
use CGI::Carp qw/fatalsToBrowser/;