Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon, which comes first ob_start or session, wwwxxx/58/2010

Links

XODOX
Impressum

#1: cgi web app gives "premature end of script headers" but it"s there

Posted on 2008-04-22 21:07:01 by drhowarddrfine

To get back to basics from a thread I entered elsewhere, I just tried
to access a small C program that does nothing but create an empty web
page. I put it in cgi-bin and give that folder and the app 755
permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
internal server error and the error log says: "Premature end of script
headers: /home/rbelics/public_html/cgi-bin/test".

However, run locally on the command line, the output is correct:
Content-type: text/html; charset=utf-8

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd"><html><head><title>

The only thing in the cgi-bin .htaccess file is "Options ExecCGI"

Am I missing something?

Report this message

#2: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-22 23:55:28 by usenetpersongerryt

On Apr 22, 12:07 pm, drhowarddrfine <robbel...@gmail.com> wrote:
> To get back to basics from a thread I entered elsewhere, I just tried
> to access a small C program that does nothing but create an empty web
> page. I put it in cgi-bin and give that folder and the app 755
> permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
> internal server error and the error log says: "Premature end of script
> headers: /home/rbelics/public_html/cgi-bin/test".
> However, run locally on the command line, the output is correct:
> Content-type: text/html; charset=utf-8
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd"><html><head><title>
> The only thing in the cgi-bin .htaccess file is "Options ExecCGI"
> Am I missing something?

Perhaps your push cart ran outa gas?? Then again this comes up over
and
over when someone embeds ^M characters in a cgi by using a M$ editor
to create it in the first place. It works on command line but Apache
sees
^M and bales. Perhaps Dr. Curly could perform an operation...

Report this message

#3: Re: cgi web app gives "premature end of script headers" but it"s there

Posted on 2008-04-23 00:42:13 by Felix Saphir

usenetpersongerryt@gmail.com wrote:

> On Apr 22, 12:07 pm, drhowarddrfine <robbel...@gmail.com> wrote:
>> To get back to basics from a thread I entered elsewhere, I just tried
>> to access a small C program that does nothing but create an empty web
>> page. I put it in cgi-bin and give that folder and the app 755
>> permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
>> internal server error and the error log says: "Premature end of
>> script headers: /home/rbelics/public_html/cgi-bin/test".
>> However, run locally on the command line, the output is correct:
>> Content-type: text/html; charset=utf-8
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
>> TR/html4/strict.dtd"><html><head><title>
>> The only thing in the cgi-bin .htaccess file is "Options ExecCGI"
>> Am I missing something?
>
> Perhaps your push cart ran outa gas?? Then again this comes up over
> and
> over when someone embeds ^M characters in a cgi by using a M$ editor
> to create it in the first place. It works on command line but Apache
> sees ^M and bales. Perhaps Dr. Curly could perform an operation...

Yes. Sure. He uses notepad.exe and then sets file permissions to 0755 on
a file in /home/rbelics/public_html/... Sounds reasonable.

Felix

Report this message

#4: Re: cgi web app gives "premature end of script headers" but it"s there

Posted on 2008-04-23 00:46:46 by Felix Saphir

drhowarddrfine wrote:

> To get back to basics from a thread I entered elsewhere, I just tried
> to access a small C program that does nothing but create an empty web
> page. I put it in cgi-bin and give that folder and the app 755
> permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
> internal server error and the error log says: "Premature end of script
> headers: /home/rbelics/public_html/cgi-bin/test".
>
> However, run locally on the command line, the output is correct:
> Content-type: text/html; charset=utf-8
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd"><html><head><title>
>
> The only thing in the cgi-bin .htaccess file is "Options ExecCGI"
>
> Am I missing something?

Perhaps: Who's the owner of that compiled C program? If you're owner and
the permissions are set to 0755, then the apache user (perhaps wwwrun?)
won't be allowed to execute the program. Does it work after chmod 0777?

Felix

Report this message

#5: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 01:14:32 by drhowarddrfine

On Apr 22, 5:46 pm, Felix Saphir <dasr060-use...@yahoo.de> wrote:
> drhowarddrfine wrote:
> > To get back to basics from a thread I entered elsewhere, I just tried
> > to access a small C program that does nothing but create an empty web
> > page. I put it in cgi-bin and give that folder and the app 755
> > permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
> > internal server error and the error log says: "Premature end of script
> > headers: /home/rbelics/public_html/cgi-bin/test".
>
> > However, run locally on the command line, the output is correct:
> > Content-type: text/html; charset=utf-8
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> > TR/html4/strict.dtd"><html><head><title>
>
> > The only thing in the cgi-bin .htaccess file is "Options ExecCGI"
>
> > Am I missing something?
>
> Perhaps: Who's the owner of that compiled C program? If you're owner and
> the permissions are set to 0755, then the apache user (perhaps wwwrun?)
> won't be allowed to execute the program. Does it work after chmod 0777?
>
> Felix

Changing it to 777 didn't do anything. I should say that I'm on a
shared host system and not my own.
That's a question I have about ownership. The static html files are
accessed, though. Were uploaded the same way.

I compiled this little program on FreeBSD but it's a Linux platform.
Could that have anything to do with it? All it is is a series of
printfs to stdout.

Report this message

#6: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 01:15:52 by usenetpersongerryt

On Apr 22, 3:42 pm, Felix Saphir <dasr060-use...@yahoo.de> wrote:
> usenetpersonger...@gmail.com wrote:
> > On Apr 22, 12:07 pm, drhowarddrfine <robbel...@gmail.com> wrote:
> >> To get back to basics from a thread I entered elsewhere, I just tried
> >> to access a small C program that does nothing but create an empty web
> >> page. I put it in cgi-bin and give that folder and the app 755
> >> permissions. When I access mysite.com/cgi-bin/myapp, I get a 500
> >> internal server error and the error log says: "Premature end of
> >> script headers: /home/rbelics/public_html/cgi-bin/test".
> >> However, run locally on the command line, the output is correct:
> >> Content-type: text/html; charset=utf-8
> >> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> >> TR/html4/strict.dtd"><html><head><title>
> >> The only thing in the cgi-bin .htaccess file is "Options ExecCGI"
> >> Am I missing something?
> > Perhaps your push cart ran outa gas?? Then again this comes up over and
> > over when someone embeds ^M characters in a cgi by using a M$ editor
> > to create it in the first place. It works on command line but Apache
> > sees ^M and bales. Perhaps Dr. Curly could perform an operation...
> Yes. Sure. He uses notepad.exe and then sets file permissions to 0755 on
> a file in /home/rbelics/public_html/... Sounds reasonable.

I re-read the post and...
Only if the cgi is a script. If its compiled C then no. It could be an
suexec
problem too. And that should be DrHowardDrFineDrHoward. There were 3
Stooges.

Report this message

#7: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 01:25:03 by drhowarddrfine

And that should be DrHowardDrFineDrHoward. There were 3
> Stooges.

Forums truncate too often.

Report this message

#8: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 01:37:44 by usenetpersongerryt

On Apr 22, 4:25 pm, drhowarddrfine <robbel...@gmail.com> wrote:
> And that should be DrHowardDrFineDrHoward. There were 3 Stooges.
> Forums truncate too often.

Now that we've established that universe is flawed, the origiinal
question
remains... You are attempting to run a cgi in a user directory. As I
recall
suexec must or at least should be enabled for this to work, compiled
binary or script.
The log message may be misleading you.

Report this message

#9: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 01:47:22 by drhowarddrfine

On Apr 22, 6:37 pm, usenetpersonger...@gmail.com wrote:
> On Apr 22, 4:25 pm, drhowarddrfine <robbel...@gmail.com> wrote:
>
> > And that should be DrHowardDrFineDrHoward. There were 3 Stooges.
> > Forums truncate too often.
>
> Now that we've established that universe is flawed, the origiinal
> question
> remains... You are attempting to run a cgi in a user directory. As I
> recall
> suexec must or at least should be enabled for this to work, compiled
> binary or script.
> The log message may be misleading you.

I've read elsewhere that might have something to do with it. I'll
pass that along as I finally decided to contact the sysadmins to see
if they can see what's happening. I get the feeling that, unless it's
PHP, they don't know.

Report this message

#10: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 04:59:18 by drhowarddrfine

Well, it's more complicated than I thought. I compile the app on
FreeBSD but one of the libraries doesn't exist on Linux. I haven't
thoroughly looked into it but I have to find a way to make this more
standalone.

Thanks guys.
Doc

Report this message

#11: Re: cgi web app gives "premature end of script headers" but it"s there

Posted on 2008-04-23 10:31:53 by Felix Saphir

drhowarddrfine wrote:
> On Apr 22, 5:46 pm, Felix Saphir <dasr060-use...@yahoo.de> wrote:
>> drhowarddrfine wrote:
>>> [small C program as cgi, chmod 0755, gives error 500]
>> [permissions okay? chmod 0777?]
>
> Changing it to 777 didn't do anything. I should say that I'm on a
> shared host system and not my own. That's a question I have about
> ownership. The static html files are accessed, though. Were uploaded
> the same way.
>
> I compiled this little program on FreeBSD but it's a Linux platform.
> Could that have anything to do with it? All it is is a series of
> printfs to stdout.

Sorry, I'm not an expert with C across different platforms, but it might
help to link the libraries statically (heard that somewhere :) ). Is
the architecture on both systems the same (like x86)?

Felix

Report this message

#12: Re: cgi web app gives "premature end of script headers" but it"s

Posted on 2008-04-23 14:17:48 by drhowarddrfine

On Apr 23, 3:31 am, Felix Saphir <dasr060-use...@yahoo.de> wrote:
> drhowarddrfine wrote:
> > On Apr 22, 5:46 pm, Felix Saphir <dasr060-use...@yahoo.de> wrote:
> >> drhowarddrfine wrote:
> >>> [small C program as cgi, chmod 0755, gives error 500]
> >> [permissions okay? chmod 0777?]
>
> > Changing it to 777 didn't do anything. I should say that I'm on a
> > shared host system and not my own. That's a question I have about
> > ownership. The static html files are accessed, though. Were uploaded
> > the same way.
>
> > I compiled this little program on FreeBSD but it's a Linux platform.
> > Could that have anything to do with it? All it is is a series of
> > printfs to stdout.
>
> Sorry, I'm not an expert with C across different platforms, but it might
> help to link the libraries statically (heard that somewhere :) ). Is
> the architecture on both systems the same (like x86)?
>
> Felix

Yes, they're both x86. I briefly attempted static linking before I
went to bed. Uploaded it and it still failed but I may not have
compiled it correctly. I have to wake up and dig around on this.

Report this message