brian.hines@qwest.co has asked for the wisdom of the Perl Monks concerning the following question:

Hi - would very much appreciate any help with an issue I am having. I am *very* new to installing/configuring perl/apache, so am probably missing something simple/stupid.... But, here goes.

First, I am on Perl 5.8.8, Apache 2.0.52, Sun Sol 10, using DBI 1.58 and DBD (oracle) 1.19.

I am in the middle of trying to migrate some applications from an old server to new. I have installed all the above and a few other packages, and have some batch type perl scripts running using DBI/DBD just fine. I am now trying to get some programs running that are CGI based. When I try to run my script that uses DBI, I am getting this error in the Apache error log:

[Wed Aug 15 14:29:18 2007] [error] [client 10.0.112.59] Can't locate +loadable object for module DBI in @INC (@INC contains: /u/netops/perl +/lib/5.8.8/sun4-solaris-64 /u/netops/perl/lib/5.8.8 /u/netops/perl/li +b/site_perl/5.8.8/sun4-solaris-64 /u/netops/perl/lib/site_perl/5.8.8 +/u/netops/perl/lib/site_perl .) at /u/netops/perl/lib/site_perl/5.8.8 +/sun4-solaris-64/DBI.pm line 261 [Wed Aug 15 14:29:18 2007] [error] [client 10.0.112.59] BEGIN failed-- +compilation aborted at /u/netops/perl/lib/site_perl/5.8.8/sun4-solari +s-64/DBI.pm line 261. [Wed Aug 15 14:29:18 2007] [error] [client 10.0.112.59] Compilation fa +iled in require at /u/netops/apache2/cgi-bin/overutilization.perl lin +e 22. [Wed Aug 15 14:29:18 2007] [error] [client 10.0.112.59] BEGIN failed-- +compilation aborted at /u/netops/apache2/cgi-bin/overutilization.perl + line 22. [Wed Aug 15 14:29:18 2007] [error] [client 10.0.112.59] Premature end +of script headers: overutilization.perl
I think that DBI is correctly configured in general, as I can run the batch/non-CGI type scripts fine. I looked through other posts and found one indicating some environment settings, so added settings for the LD_LIBRARY_PATH and such to the httpd.conf, but that did not do anything. I also tried to add some addt'l oracle libraries to the @INC so it would match my normal LD_LIBRARY_PATH, that also didn't seem to affect anything:
push (@INC, "/opt/dbms/oracle/product/ora1020_64/lib", "/usr/lib", "/u +sr/ccs/lib", "/usr/dt/lib");
Any help would be *greatly* appreciated! THANKS! BH

Replies are listed 'Best First'.
Re: Perl/Apache/DBI Config Problem
by almut (Canon) on Aug 15, 2007 at 22:53 UTC

    Depending on how you installed the DBI module, it could be a permission problem...  Make sure the associated "loadable object" DBI.so (look for auto/DBI/DBI.so in one of the @INC directories) is accessible for the webserver user, which typically means that the file itself must be world-readable, and all directories on that path must at least have 'x' permission (for other/world).

Re: Perl/Apache/DBI Config Problem
by jZed (Prior) on Aug 15, 2007 at 22:57 UTC
    "Can't locate loadable object for module DBI" indicates that DBI (not DBD::Oracle, but DBI itself) is not installed properly, specifically that the XS portion (usually found in auto/* directories) is either not where your perl expects it to be or is not compiled correctly for the platform. If it works on the command line and not in CGI, then make sure both environments are running the same version of perl and if needed, tweak the @INC for the CGI with use lib.
Re: Perl/Apache/DBI Config Problem
by technojosh (Priest) on Aug 15, 2007 at 21:54 UTC
    I doubt your problem is in apache or its httpd.conf file.

    Perl is crapping out because of some problem loading the DBI module, that is how I'd start to attack the problem.

    That is my very general answer since I have not seen your code. I'm sure there are some perl/cgi wizards here that can help if you give a better idea of the script that is giving this error...

Re: Perl/Apache/DBI Config Problem
by brian.hines@qwest.co (Initiate) on Aug 16, 2007 at 15:54 UTC
    Excellent! I found that the files were world read, but not execute. I chmod'd the entire lib directory to make everything 755, that seemed to work great. Now on to debug other issues..... THANKS very much all! BH