LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-01-2005, 08:25 PM   #1
bhomass
Member
 
Registered: Nov 2005
Posts: 69

Rep: Reputation: 15
Premature end of script headers


I recently upgraded to Debian Sarge stable, kernel 2.6.8.

I am running a opensource web app on the system with some c binaries as cgi programs.

I keep getting Premature end of script headers. the binary runs fine from command line, with all the necessary headers returned. it seems apache2 simply does not get the reply header/content. is there a module that might be missing which would cause this?
 
Old 12-02-2005, 05:31 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Re: Premature end of script headers

Quote:
Originally posted by bhomass I keep getting Premature end of script headers. the binary runs fine from command line, with all the necessary headers returned.
Your headers should be something like:
Code:
Content-Type: text/html
<blank line>
Your actual content...
Obviously "<blank line>" above is not literal, it means there's actually a blank line in that space.

If your script runs from the command line, but fails when run from the webserver, the first thing I'd look at is the environment. The environment from your command line may allow the script to run, but the (different, and more limited) environment when invoked by the webserver may not. An executing script that produces nothing on it's output will result in that "Premature end of script headers" error. Ditto for a core dumping script, ... etc. You could also try running your script as a cron job under the same userid that runs the webserver, and trap it's stdout and stderr to a file to see what might be going on. Cron will give you a limited environment, just as running under the webserver will.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Premature end of script headers: CGI fatturi Linux - Newbie 4 07-19-2007 04:55 PM
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 11:43 AM
Premature end of script headers webhead Red Hat 5 09-22-2004 01:56 AM
Perl/CGI Problem "Premature Premature end of script headers: countdown.pl" newuser455 Linux - Software 2 07-18-2004 11:47 AM
Premature End of Script Headers (Error 500) bsdb3 Red Hat 5 05-06-2004 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration