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

Hi everyone!
I'm beginning to learn CGI, with apache in windows. The code is simple:
#!perl ## ## printenv -- demo CGI program which just prints its environment ## print "Content-type: text/plain\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; }
However, it always tell me:
couldn't create child process: 720003: printenv.pl couldn't spawn child process: C:/Program Files/Apache Software Foundat +ion/Apache2.2/cgi-bin/printenv.pl
but "perl" is in path, and can be called directly.
Moreover, I also tried #!c:/camelbox/bin/perl, it also don't work.

Replies are listed 'Best First'.
Re: Fail to spawn perl in apache
by aquarium (Curate) on Jan 29, 2010 at 03:23 UTC
    Please lookup the relevant config for perl/cgi on apache documentation. Apache runs as another userid and has a different environment than what you have when logged in.
    the hardest line to type correctly is: stty erase ^H
      I also tried to include perl path in the script 1st line, but it also not work.
        That is also an apache configuration issue
        Go to Start-> Search and look for perl.exe. It'll return the path you need for the 1st line.
Re: Fail to spawn perl in apache
by Anonymous Monk on Jan 29, 2010 at 02:35 UTC
    It may be in path, but apache clearly can't see it