Basis of the problem. I have a university assignment requiring me to write a Perl/CGI based website for a phonebook. This part is fine and I'm happy with it, however, I have issues with wrapping the cgi files. I've done it once before no issues but been unable to replicate that success this time doing the same thing.
Basic Perl file to show user ID's:
#!/usr/bin/perl -w
use English;
print "Content-type: text/html";
print "\n";
print "\n";
print "\n";
print "<html>\n";
print "<head><title>IDS.CGI</title></head>\n";
print "<body>\n";
print "<p>\nMy User ID is $UID\n</p>";
print "<p>\nMy effective User ID is $EUID\n</p>";
print "<p>\nMy Group ID is $GID\n</p>";
print "<p>\nMy effective Group ID is $EGID\n</p>";
print "\n</body>\n";
print "</html>\n";
Wrapper.C:
#include <stdio.h>
#include <unistd.h>
#define REAL_PATH "ids.pl"
int
main()
{
execl( REAL_PATH, REAL_PATH, 0 );
printf( "You should never see this message!\n" );
}
This is throwing an internal server error 500. I've tried my best to debug it including spacing for the headers etc. It runs fine in terminal but not in the web browsers. The servers httpd error log shows that the error of "Premature end of headers". I cannot see how there is a premature end however.
Any help anyone can offer would be greatly appreciated.