tmaggard has asked for the wisdom of the Perl Monks concerning the following question:

I have reviewed a ton of postings, but have not found a solution to my current issue. I can run my script from the command line, and it works fine, but when I run it through Apache, I receive the following...

Can't load 'c:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at c:/Perl/lib/DynaLoader.pm line 206. Compilation failed in require at d:\cnlts\cgi-bin\sample.cgi line 5. BEGIN failed--compilation aborted at d:\cnlts\cgi-bin\sample.cgi line 5.

I have verified that the Oracle.dll file exists in the path mentioned. I believe that I have checked the permissions correctly. Still to no avail. If I remove the "use DBD::Oracle;" statement, the error goes away.

Help, O' Wise Ones!

- Torrey

Replies are listed 'Best First'.
Re: Can't load Oracle.dll - HELP!!!
by tachyon (Chancellor) on Nov 26, 2004 at 06:40 UTC

    As ysth says your install of DBD::Oracle is probably broken. If you RTFS of Dynaloader you will see:

    # Many dynamic extension loading problems will appear to come from # this section of code: XYZ failed at line 123 of DynaLoader.pm. # Often these errors are actually occurring in the initialisation # C code of the extension XS file. Perl reports the error as being # in this perl code simply because this was the last perl code # it executed. my $libref = dl_load_file($file, $module->dl_load_flags) or croak("Can't load '$file' for module $module: ".dl_error());

    As you claim to be able to run it off the command line the other possibilities include permissions or perhaps more than one version of Perl on the box. If you are positive it works off the command line then Permissions would be top of the list.

    cheers

    tachyon

Re: Can't load Oracle.dll - HELP!!!
by ysth (Canon) on Nov 26, 2004 at 06:02 UTC
    Sounds like you have a broken installation of DBD::Oracle; how did you install it?
Re: Can't load Oracle.dll - HELP!!!
by mpeppler (Vicar) on Nov 26, 2004 at 09:13 UTC
    DBD::Oracle can't work on its own - do you have all the necessary Oracle libraries/files installed on your system?

    Michael

      Yes, I believe I have all of the necessary Oracle libraries installed. The script works fine from the command line, which leads me to believe that I am encountering a permission issue with Apache...I am just not sure where to look for this issue.

      - Torrey
        If the scripts work from the command line then it's usually a case of making sure that the environment is duplicated in the Apache setup. My Oracle know-how is approximately zero, so I don't know what you need to set - but check your environment in your DOS shell, and then add the appropriate entries to your httpd.conf file (see the SetEnv directive).

        Michael

Re: Can't load Oracle.dll - HELP!!!
by rickest (Novice) on Nov 26, 2004 at 16:17 UTC
    It sounds to me like Oracle.dll cannot load because it cannot find your real (non-perl) Oracle libraries. You probably need to add $ORACLE_HOME to the script that starts Apache. Your httpd error_log should say something to that effect if this is the problem. If you're running mod_perl, you'll probably need the following somewhere in your httpd.conf file as well:
    PerlPassEnv ORACLE_HOME
    Regards,
    Rick
      I did fail to mention that the Oracle client I installed on this box is version 10g. Have you heard of any issues with 10g? I will try your recommendation. Thanks!

      - Torrey