in reply to
Perl 500 error
CGI comes with Perl, so it's kinda hard to imagine it being not found unless 1) your vendor butchered Perl (in which case there's a probably a package you can install to add it back), 2) someone moved or deleted it, or 3) it's there, but a file permission issue prevents it from being used.
There are similarly a few reason why your shell command could find CGI.pm and your CGI script couldn't. The three most likely are 1) The two users have different permissions, 2) the two processes are executing different installations of perl, and 3) the two processes have different PERL5LIB environment variables.