Where is your libgd library installed? Is it in /usr/local/lib? You could try doing something like the following at the top of your perl script:
my $LIB = defined $ENV{LD_LIBRARY_PATH} ? $ENV{LD_LIBRARY_PATH} : ""; $ENV{LD_LIBRARY_PATH} = "/usr/local/lib:$LIB";
If that doesn't work, you can use an old trick to force LD_LIBRARY_PATH to get set:
#!/bin/sh LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH exec /usr/local/bin/perl -x -S $0 ${1+"$@"} # -*-perl-*- #!perl -w use GD; ....
Anyways, I feel like the "module not found" error is masking the real error that the module *can* be found, but can't be loaded because of other shared libraries needed for the module to work... I think Perl just displays the wrong error.
The reason it works from the command line is because your shell environment is setup different than the Apache environment. When Apache starts, it is started usually from a startup script as root, which consequently has few environment variables set, meaning LD_LIBRARY_PATH is not likely defined.
Hope this helps.
Zucan
In reply to Re: Trouble with Perl CGI script
by Zucan
in thread Trouble with Perl CGI script
by chakkaln
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |