From: "Scott Miller" <[EMAIL PROTECTED]>
Reply-To: users@httpd.apache.org
To: <users@httpd.apache.org>
Subject: Re: [EMAIL PROTECTED] Premature end of script headers
Date: Thu, 23 Feb 2006 13:53:56 -0700

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:

[EMAIL PROTECTED] cgi-bin]# ./first.pl
Content-type: text/html

Hello, [EMAIL PROTECTED] 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

is ur server running as nobody
check it

Reagrds
Azeem

In my httpd.conf file - it shows:
User nobody
Group nobody

Thanks,
Scott

ok
try it running as some other user, like create one for it, say httpuser and the set directory permissions to that user and then check
i hope it'll get executed
and also let me know if it works

Regards
Azeem



---------------------------------------------------------------------
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to