httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy D. Weiss" <>
Subject Re: [users@httpd] Premature end of script headers
Date Sat, 26 Apr 2003 16:33:25 GMT
At 01:12 PM 04/26/2003 -0300, you wrote:
>I'm tring to run my first CGI in C language. Of course it's Hello World. 
>The code is that:
>#include <stdio.h>
>int main()
>  printf("Content-type: text/html\n\n");
>  printf("<HTML>\n");
>  printf("<BODY>\n");
>  printf("<CENTER><H1>HELLO WORLD</H1></CENTER>\n");
>  printf("</BODY>\n");
>  printf("</HTML>");
>  return 0;
>when I try to run it the browser shows INTERNAL SERVER ERROR
>And the error log file shows Premature end of script headers
>I think the code is ok.
>What can I do to fix that problem?

One of the things I usually do when I encounter problems with a cgi is to 
try running it independently, from a command prompt.  You don't explicitly 
state it anywhere, but I'm assuming you compiled the program into a binary, 
and were not trying to run the C code as a script (since, AFAIK, Apache can 
not run uncompiled C code).


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message