In reply to:
I created a folder cgi-bin in my domain-dir, placed a small test script in it
8<---- test.pl
#!/usr/bin/perl
print "<p>Hello</p>\n";
8<----
# chmod 755 -R cgi-bin
# whereis perl
tells me /usr/bin/perl
# ./test.pl
works fine
In this forum and the wiki I found many people having problems with access rights, so I did a chmod 777 on the files, but this didn't do the trick.
Here is what happens when your run a CGI script:
1. The web server sets up a "CGI environment" and then executes the script.
2. The "perl" program runs your script
3. The web server expects the script output to start with headers followed by a blank line followed by the content to pass along to the web browser.
From the error message you can tell that the failure is with step #2 or step #3. From your code, it is apparent that it is at least step #3 - you did not output a set of headers.
At the minimum you need a Content-Type header. Observe.
$mime_type = 'text/html';
$header_content_type = "Content-Type: $mime_type\n";
@headers = ($header_content_type);
$blank_line = "\n";
$content = "<p>Hello</p>\n";
print
@headers,
$blank_line,
$content;
The reason you get "premature end of headers" messages is because the output the web server sees is not a set of headers. Other than skipping the headers like your script does, you can also get this message if the perl program has a problem interpreting your code (syntax errors, etc) or crashing.
openvein.org -//-