Posted on 2006-07-21 20:07:00-07 by kstype
Can't locate loadable object for module Apache::Constants in @INC error
Hello all,

I've got a webserver running Solaris 10 x86 using NIS and an Apache 2.2 webserver with mod_ssl, mod_perl2, Net::NIS and Apache::AuthenNIS support. Webserver starts fine, SSL works as well as CGI.

As soon as we try and protect a portion of the web server with NIS authentication we see the following in the error_log file:

[Fri Jul 21 15:57:58 2006] [error] [client <IP ADDRESS>] failed to resolve handler `Apache::AuthenN +IS': Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /usr/local/ +lib/perl5/5.8.7/i86pc-solaris /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/i86p +c-solaris /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl . /usr/local/apache2 +.2) at /usr/local/lib/perl5/site_perl/5.8.7/i86pc-solaris/mod_perl.pm line 14\nCompilation failed +in require at /usr/local/lib/perl5/site_perl/5.8.7/Apache/AuthenNIS.pm line 29.\nBEGIN failed--com +pilation aborted at /usr/local/lib/perl5/site_perl/5.8.7/Apache/AuthenNIS.pm line 32.\nCompilation + failed in require at (eval 2) line 3.\n

All the research I could do on Apache::Constants seems to involve versions of mod_perl earlier than our 2.x version. Can anyone give me some pointers on how to resolve this?

My compile info is:

bash-3.00# ./httpd -V Server version: Apache/2.2.0 Server built: Jul 21 2006 09:50:15 Server's Module Magic Number: 20051115:0 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FCNTL_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/usr/local/apache2.2" -D SUEXEC_BIN="/usr/local/apache2.2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" <p></P> bash-3.00# perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=solaris, osvers=2.10, archname=i86pc-solaris uname='sunos nmbctsweb2 5.10 generic i86pc i386 i86pc ' config_args='-Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE +_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.4.3 (csl-sol210-3_4-branch+sol_rpath)', gccosandvers='solaris2.10' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib ' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -lgdbm -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under solaris Compiled at Jul 19 2006 15:27:49 @INC: /usr/local/lib/perl5/5.8.7/i86pc-solaris /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/i86pc-solaris /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl
Direct Responses: 8396 | Write a response
Posted on 2008-07-24 13:32:46-07 by sh4r4d in response to 2666
Re: Can't locate loadable object for module Apache::Constants in @INC error
Hi Same issue I have face but now with RHEL5 in Apache-AuthenNIS, this the problem in /usr/lib/perl5/vendor_perl/5.8.8/Apache/AuthenNIS.pm wih the some mod_perl2 in RHEL5 here the use mod_perl need to change to use mode_perl2 and respective Apache:: to Apache2:: This the patch.
--- AuthenNIS.pm 2008-07-25 00:46:36.000000000 +0530 +++ AuthenNIS.pm.Modified 2008-07-25 00:46:39.000000000 +0530 @@ -9,22 +9,23 @@ $Apache::AuthenNIS::VERSION = '0.13'; ############################################ # here is where we start the new code.... ############################################ -use mod_perl ; +use mod_perl2 ; # setting the constants to help identify which version of mod_perl # is installed -use constant MP2 => ($mod_perl::VERSION >= 1.99); +use constant MP2 => ($mod_perl2::VERSION >= 1.99); # test for the version of mod_perl, and use the appropriate libraries BEGIN { if (MP2) { - require Apache::Const; - require Apache::Access; - require Apache::Connection; - require Apache::Log; - require Apache::RequestRec; - require Apache::RequestUtil; - Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERVER_ +ERROR', 'DECLINED'); + require Apache2::Const; + require Apache2::Access; + require Apache2::Connection; + require Apache2::Log; + require Apache2::RequestRec; + require Apache2::RequestUtil; + Apache2::Const->import( -compile => ('HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERV +ER_ERROR', 'DECLINED')); +# use Apache2::Const -compile => qw( HTTP_INTERNAL_SERVER_ERROR DECLINED HTTP_UNAUT +HORIZED OK ); } else { require Apache::Constants; Apache::Constants->import('HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERVER_ERROR', +'DECLINED'); @@ -32,6 +33,7 @@ BEGIN { } ##################### end modperl code ###################### + sub handler { my $r = shift; my($res, $sent_pwd) = $r->get_basic_auth_pw; @@ -45,13 +47,13 @@ sub handler { unless($domain) { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - cannot obtain NIS domain", $r->uri) : $r->log_re +ason("Apache::AuthenNIS - cannot obtain NIS domain", $r->uri); - return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR; + return MP2 ? Apache2::Const::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER +_ERROR; } if ($name eq "") { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - no username given", $r->uri) : $r->log_reason("Ap +ache::AuthenNIS - no username given", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } my ($status, $entry) = Net::NIS::yp_match($domain, "passwd.byname", $name); @@ -59,35 +61,35 @@ sub handler { if($status) { if (lc($allowaltauth) eq "yes" && $status == 5) { - return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED; + return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED; } else { my $error_msg = Net::NIS::yperr_string($status); $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - user $name: yp_match: status $status, $error_ +msg", $r->uri) : $r->log_reason("Apache::AuthenNIS - user $name: yp_match: status $status, $error_ +msg", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } } my ($user, $hash, $uid, $gid, $gecos, $dir, $shell) = split(/:/, $entry); if(crypt($sent_pwd, $hash) eq $hash) { - return MP2 ? Apache::OK : Apache::Constants::OK; + return MP2 ? Apache2::Const::OK : Apache::Constants::OK; } else { if (lc($allowaltauth) eq "yes") { - return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED; + return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED; } else { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - user $name: bad password", $r->uri) : $r->log_r +eason("Apache::AuthenNIS - user $name: bad password", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } } - return MP2 ? Apache::OK : Apache::Constants::OK; + return MP2 ? Apache2::Const::OK : Apache::Constants::OK; } 1;
. Regards and Thanks Sharad
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.