1) I think it may be a path issue. Check the absoute pathname and try it again (
ls is a shell builtin and requires no path).
2) Try calling the external script with
system and check the return value. Then try calling it with backticks.
3) Try running something like this from the cgi:
foreach my $key (keys %ENVY) {
print "$key: $ENV{$key}\n";
}
look at the output. Is there anything weird there that would screw with shell processes?
4) Also, make sure that there aren't any zombie processes of apache hanging on. If there are, try running the script and redirecting the output to
/dev/null.
I've had weird issues with apache zombying off
httpd processes because a called cgi program forked off another shell for the process. Even though the process finished fine, the second process seemed to never let go of the shell (even though it did). We observed this at my workplace with a cgi that started mysql. The supplied
mysql.server script seems to break Apache + mod_perl when you call it from a cgi. We finally solved the problem by calling
mysql.server and redirecting
STDERR and
STDOUT to
/dev/null.
BlueLines
Disclaimer:
This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.