CGI Problem

I’m having problems running a CGI via the web. I made a simple test case.

I have a file called “test.cgi” with the following contents:

echo Content-Type: text/plain

If I type “sh < test.cgi”, it works.

However if I try via the web (i.e. I get the error listed below.

Any suggestions?

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Here is some more info. Checking the logs, this is the error message (not sure what it means)

[Tue Oct 21 16:50:14 2003] [error] [client] Premature end of scr
ipt headers: /blah/blah/test.cgi
[Tue Oct 21 16:50:14 2003] [error] [client] File does not exist:

Did you chmod it to 755 ?

:cool: Perl / MySQL / HTML+CSS

Hmm… You were right in narrowing it down to a permission problem, but its not in the way you suggested. The file itself was 755. On further testing it works if I put it in my root directory. If I put it in a sub-directory it fails to work. My sub-directories are set as drwxrwxr-x, which seems correct to me. Am I missing something?

Thanks for your help!!

The directories (which contain CGI scripts) can’t be group writable either.

Yes! That’s it. Thank you very much.