httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Miller" <srmil...@interbel.net>
Subject Re: [users@httpd] Premature end of script headers
Date Fri, 24 Feb 2006 04:54:45 GMT
>>>>>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
>>>
>>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



I created a new user called httpuser, tried both:

/shell/nologin
/bin/bash

Both produced the following errors in my logs:

[Thu Feb 23 15:23:07 2006] [error] [client xx.xx.xx.xx] (13)Permission
denied: exec of '/usr/sbin/suexec' failed
[Thu Feb 23 15:23:07 2006] [error] [client xx.xx.xx.xx] Premature end of
script headers: hello.cgi
[Thu Feb 23 15:23:13 2006] [error] [client xx.xx.xx.xx] (13)Permission
denied: exec of '/usr/sbin/suexec' failed
[Thu Feb 23 15:23:13 2006] [error] [client xx.xx.xx.xx] Premature end of
script headers: hello.pl
[Thu Feb 23 15:23:17 2006] [error] [client xx.xx.xx.xx] (13)Permission
denied: exec of '/usr/sbin/suexec' failed
[Thu Feb 23 15:23:17 2006] [error] [client xx.xx.xx.xx] Premature end of
script headers: test.pl
[Thu Feb 23 15:23:19 2006] [error] [client xx.xx.xx.xx] (13)Permission
denied: exec of '/usr/sbin/suexec' failed
[Thu Feb 23 15:23:19 2006] [error] [client xx.xx.xx.xx] Premature end of
script headers: test.pl

I then went back to the website:

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

and re-read about suexec, and disabled it, restarted apache, changed user
and group back to nobody, restarted again.  It complained a bit about:

Warning: SuexecUserGroup directive requires SUEXEC wrapper.

which probably comes from my httpd.conf file - the SuexecUserGroup:

<VirtualHost xx.xx.xx.xx:80>
SuexecUserGroup "#508" "#508"
ServerName newdomain.com
ServerAlias www.newdomain.com
DocumentRoot /home/testdomain/public_html
ErrorLog /home/testdomain/logs/error_log
CustomLog /home/testdomain/logs/access_log common
ScriptAlias /cgi-bin/ /home/testdomain/cgi-bin/
<Directory /home/testdomain/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks
allow from all
</Directory>
</VirtualHost>

With all that said, it will now run the cgi scripts fine.

My problem probably started when I followed the directions below to build my
Fedora Core 4 server:

http://www.falkotimme.com/howtos/perfect_setup_fedora_core_4/

Anyways - it's all working for now.

Thanks for your help.
Scott Miller
________________________________________________
Message sent using
InterBel.net Webmail 2.7.2 at www.interbel.net


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message