Why would this CGI script produce an internal server error (500)?

  • Thread starter Thread starter snowman
  • Start date Start date
S

snowman

Guest
The following C code, when compiled will produce a 500 error when ran through Apache (if ran through an SSH session, it's fine).

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Content-type: text/plain\n\n");
printf("Hello world :o\n");
system("whoami");
return 0;
}

If I remove the system() call, it works fine. If I change it to system(""), it also works. Just... having something in there causes it to fall over. Any idea why this would be?
 
Back
Top