in reply to Configuration Problems

Many things could be wrong. The most likely possibility is that there is an environment difference between when you run things in the shell and in the webserver. The following script can give you the environment:
#! /usr/bin/perl use Data::Dumper; print "text/plain\n\n"; print Dumper(\%ENV);
Use that to figure out what your shell's environment and your script's environment are. Start adjusting things one at a time in your shell, trying the script, and see when it breaks, telling you what you need to take care of.

If that isn't it, then I'd look for a chroot, the webserver executing from a different directory that you expect or a problem because the webserver is a different user than you are.

If those aren't it, then you're getting into more esoteric territory. Odds are that you won't have to go into esoteric territory.