dsb has asked for the wisdom of the Perl Monks concerning the following question:

I've got Apache 1.3 installed on my home PC. I am able to access regular HTML pages but when I try to access a CGI script I get back Internal Server Error. I know that in most cases that means a problem with Premature end of script headers problem. However, when I looked in the error log for Apached I saw this:
[Mon Feb 19 15:55:27 2001] [error] [client 127.0.0.1] couldn't spawn c +hild process: c:/program files/apache group/apache/cgi-bin/test.pl
ok,ok...maybe Windows is the start of my problems. Regardless, I have to have this on my Windows partition so my girlfriend can use this Web-App. The code for the test script is exactly the code from Ovid's CGI Course except for the she-bang line, for the sake of testing.
#!c:\Perl\bin -wT use strict; use CGI; my $query = CGI->new(); print $query->header( "text/html" ), $query->start_html(-title => "My First CGI Script", -bgcolor => "#ffffcc" ), $query->h1( "This is a pretty lame Web page" ), $query->p( "Who is this Ovid guy, anyway?" ), $query->end_html;
Any help would be greatly appreciated.

- kel -

Replies are listed 'Best First'.
Re: CGI Problems
by dws (Chancellor) on Feb 20, 2001 at 02:08 UTC
    The #! line needs the full path to perl.exe. And use forward slashes.
Re: CGI Problems
by arturo (Vicar) on Feb 20, 2001 at 02:39 UTC

    Also, check your Apache config and make sure

    Options +ExecCGI

    is turned on for your cgi-bin directory (while you're at it, make sure you have a Directory or Location entry for your cgi-bin directory!)

    And make sure that Apache has mod_cgi support compiled in (or that its available as a dll) -- this last is unlikely to be the problem if you got a precompiled binary.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Re: CGI Problems
by marius (Hermit) on Feb 20, 2001 at 02:09 UTC
    Have you associated Perl with *.pl files as mentioned in this node?

    -marius

    Update:and as dws mentions, tack perl.exe onto your #! line so it looks like #!c:/perl/bin/perl.exe -wT