Re: [users@httpd] Premature end of script headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fedora Core 4
Apache 2.0.54

I seem to be having this same problem.  I read the manual at:

http://httpd.apache.org/docs/2.0/howto/cgi.html#writing

and created the "first.pl" file. when I run "./first.pl" from the command
line, all it prints is:

Content-type: text/html

and does not print the "Hello, World." at all.

And in my browser - it gives me the "Internal Server Error"

All it says in my error logs is:

[Thu Feb 23 08:55:35 2006] [error] [client xx.xx.xx.xx] Premature end of script headers: first.pl

If anyone could point me in the direction where I need to look, it would be
greatly appriciated

It sounds a lot like you are missing the empty line that terminates
the header.    This is the 'header' that initiates the transfer and
precedes the <html><head>... stuff.   It is usually sent for you when
the server reads and sends out a .html file.    But if you are running
a script or binary that is creating the content, you have to take care
of that little detail.

You need to start with a line something like:

 Content-type: text/html\n\n

eg.  in Perl, for example a print for the first of the data sent
   would look like:

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


////jerry

That's exactly what I have - here's the first.pl file:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";

Also - I guess ie does work via command line as shown:

[root@serv7 cgi-bin]# ./first.pl
Content-type: text/html

Hello, World.[root@serv7 cgi-bin]#

Just "missed" it since it was on the same line - I then added a couple \n\n to it, and it prints nicely.

However, it does not display anything vai the browser - just the "Internal Server Error"

[Thu Feb 23 12:45:35 2006] [error] [client xx.xx.xx.xx] Premature end of script headers: first.pl

Thanks for the help.
Scott


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux