chenino chenino - 1 year ago 56
Perl Question

Can't load 'C:/Apache/Perl/site/lib/auto/Apache2/ModSSL/ModSSL.dll'

I am running an Windows Server 2008 R2 Enterprise with an Apache Server installed and mod_perl & mod_ssl
I just installed Apache2::ModSSL, but i was not able to use cpan for this and had to compile it using nmake. CPAN is not working correctly on this Server and i am not able to change this.
A perl script called via https should later be able to Access the certificate the Clients used to authenticate, thats why i want to use Apache2::ModSSL to Access the SSL variables.

When i try to acess my test script after implementing

use Apache2::ModSSL;

i get an HTTP500 error from the Server.
The Servers error log states

[Fri Jul 01 15:01:58 2016] [error] [client] failed to resolve handler `ssl::hello': Can't load 'C:/Apache/Perl/site/lib/auto/Apache2/ModSSL/ModSSL.dll' for module Apache2::ModSSL: load_file:The specified module could not be found at C:/Apache/Perl/lib/ line 68.\n at C:/Apache/Perl/site/lib/Apache2/ line 8\nCompilation failed in require at ssl/ line 7.\nBEGIN failed--compilation aborted at ssl/ line 7.\nCompilation failed in require at (eval 3) line 3.\n

When i check the file Location, ModSSL.dll is stored at exact this path. I also checked the file Access and granted Full acess to All Users, System, Administrators etc. Apache was restarted multiple times and it did not Change anything.
When i tried to execute it in a cmd, obviously there was no Connection to check but i could execute

use Apache2::ModSSL;
print Apache2::ModSSL->VERSION;

without Problems.
How to solve the issue with loading the module within Apache?

Server readme states

This is a binary distribution for Win32 of Perl 5.8.7 and Apache
2.0.54, together with mod_perl-2.0.1, mod_ssl / OpenSSL (0.9.7g), and php-4.3.11, all built with VC++ 6.0 (SP5).

cl -version

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

nmake -version

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01

Answer Source

Without investigating too deeply, the most likely reason for your problem is that perl, OpenSSL, mod_ssl etc where compiled with a different compiler than the one you used to build Apache::ModSSL.

It seems to me that the module only tries the XS version if it thinks it's running under mod_perl. You can see this in the module's Apache2/

XSLoader::load __PACKAGE__, $VERSION
  if( exists $ENV{MOD_PERL} and $ENV{MOD_PERL}=~/mod_perl/ );

It only tries to load the XS component if the MOD_PERL environment variable exists and it contains mod_perl. My guess is if you did:

C:\> set MOD_PERL=mod_perl
C:\> perl -MApache2::ModSSL -e "print $Apache2::ModSSL::VERSION"

you would encounter problems.

In addition, I feel I must emphasize the facts that your OpenSSL version in addition to perl and php seem too old to be used safely.