Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 12-01-2005, 08:25 PM   #1
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
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,192

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

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:
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:" 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 > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:17 PM.

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