From: "Scott Miller" <srmiller@xxxxxxxxxxxx> Reply-To: users@xxxxxxxxxxxxxxxx To: <users@xxxxxxxxxxxxxxxx> Subject: Re: [users@httpd] Premature end of script headers Date: Thu, 23 Feb 2006 13:53:56 -0700Fedora 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#writingand created the "first.pl" file. when I run "./first.pl" from the commandline, 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.plIf anyone could point me in the direction where I need to look, it would begreatly appriciatedIt 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"; ////jerryThat'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.plThanks for the help. Scottis ur server running as nobody check it Reagrds AzeemIn my httpd.conf file - it shows: User nobody Group nobody Thanks, Scott
oktry 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: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx