$ perl -MDBD::Oracle -E 'say $INC{qq{DBD/Oracle.pm}}'
/usr/local/lib64/perl5/5.32/DBD/Oracle.pm
Permissions on the file allow access to the file by the users as well as root. I can tail Oracle.pm as a user.
Regarding the environment variables. That was an issue, but not THE issue. I had to add my environment variables to /etc/httpd/conf.d/env.conf and restart httpd for apache to see them. I'm not sure how else I could update the environment variables for the apache user. One thing I can't seem to do is add the /usr/local/instantclient directory to the path, since the env.conf file doesn't support expanding $PATH.
Thanks for the help. It's appreciated! | [reply] [d/l] |
Regarding the environment variables. That was an issue, but not THE issue. I had to add my environment variables to /etc/httpd/conf.d/env.conf and restart httpd for apache to see them. I'm not sure how else I could update the environment variables for the apache user.
Apache has PassEnv, SetEnv, and UnsetEnv in mod_env.
One thing I can't seem to do is add the /usr/local/instantclient directory to the path, since the env.conf file doesn't support expanding $PATH.
I don't think you need to do that. You basically need some DLLs from the instant client, that are referenced in the XS part of DBD::Oracle. So that's more a LD_LIBRARY_PATH problem and less a PATH problem. Installing instant client should already have taken care of that problem.
There is an old trick that will probably still work. The environent variables for Oracle don't have to be set when the perl executable starts. It runs fine without them. The variables need to be set before perl loads DBD/Oracle.so and the DLLs from the Oracle client. So, you can set up the environment variables from within perl. That just has to happen before DBD::Oracle is loaded. The DBI module may already load DBD::Oracle way before you try to connect to Oracle, so it has to happen before loading DBI. Or, in a few lines of code:
#!/usr/bin/perl
use strict;
use warnings;
BEGIN {
# This BEGIN block must come before "use DBI" and before "use DBD:
+:Oracle", or this trick won't work!
$ENV{'WHATEVER_ORACLE_WANTS'}='is set here';
$ENV{'MAYBE_EVEN_SEVERAL'}='environment variables';
}
use DBI qw( ... ); # maybe hidden in your database handling module
If you don't run a CGI or FastCGI script, but use mod_perl, you probably need to put the BEGIN block into a startup file (see PerlRequire for the ancient mod_perl 1.0, PerlConfigRequire and PerlPostConfigRequire for mod_perl 2.0).
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] [d/l] [select] |
| [reply] [d/l] [select] |
Yes, it certainly sound like DBD::Oracle couldn't load the external (propritary) libraries from instantclient.
Note: It's been a long time since i used Oracle, but DBD::Oracle was always a bit of a bear to install, because the Oracle client bins and libs and configs are just weird and do things a bit different than any other modern database.
Other people had similar problems:
One thing, that trips me up sometimes for all kinds of software installations and permission/usergroup creation stuff: Using old login sessions that haven't loaded all the new permissions and environment variables. If you're stumped, it's always a good idea to close all SSH sessions and start fresh (or reboot, if it's on the local computer).
One thing i would re-check after a session refresh/reboot is that the Oracle provided command line tools (sqlplus, tnsping) still work as a normal user.
Downloading the tarball for DBD::Oracle and running "perl Makefile.PL && make test" as the non-root user might provide additional insight on what is failing.
Checking dmesg output and any selinux errors also often helps. I'm not a RedHat user, but here is a guide on how to check if selinux security is tripping you up in some way: How to read and correct SELinux denial messages
DBD::Oracle has a lot of open issues on the issue tracker. I couldn't find anything related, though, but OP might have additional info to put into the search bar.
| [reply] |
| [reply] |