Perl DB2 module doesn't load for Apache

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Perl DB2 module doesn't load for Apache

Postby BradW76 » 19. August 2011 00:56

I installed XAMPP 1.7.4, which includes Perl 5.10.1. I need to connect to a DB2 database, so I installed a DBD::DB2 driver. I then modified the perlinfo.pl test script that comes with XAMPP to pull records from the DB2 database and display them on a web page.

I can run the script from a command window, and it functions correctly, displaying the HTML tags, DB2 data, and perlinfo data.

But, when I run the same script via a browser going to the web server I get the following error message:

Code: Select all
Error message:
install_driver(DB2) failed: Can't load 'C:/xampp/perl/site/lib//auto/DBD/DB2/DB2.dll' for module DBD::DB2: load_file:The specified module could not be found at C:/xampp/perl/lib/DynaLoader.pm line 200. at (eval 58) line 3 Compilation failed in require at (eval 58) line 3. Perhaps a required shared library or dll isn't installed where expected at C:/xampp/htdocs/xampp/perl-db2.pl line 10 ,


The DB2.dll file is installed exactly where is says it can't load it from. I did observe that when I dumped the CGI environment, the PATH is truncated from what it is supposed to be, and the missing part is all the DB2 directories, but other than that nothing in the missing part seems relevant. The full path is:
Code: Select all
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
c:\program files\ibm\infoprint select;c:\notes;c:\program files\xlview;
c:\lotus\compnent;c:\utilities;c:\program files\common files\lenovo;
c:\program files\ibm\personal communications\;c:\program files\ibm\trace facility\;
c:\program files\common files\roxio shared\dllshared\;
c:\program files\common files\roxio shared\10.0\dllshared\;
c:\program files\ibm\gsk8\lib;C:\PROGRA~1\IBM\SQLLIB\BIN;
C:\PROGRA~1\IBM\SQLLIB\FUNCTION;
C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL

And the CGI environment version is truncated:
Code: Select all
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;
C:\Program Files\IBM\Infoprint Select;C:\Notes;C:\Program Files\XLView;
C:\lotus\compnent;C:\Utilities;C:\Program Files\Common Files\Lenovo;
C:\Program Files\IBM\Personal Communications\;C:\Program Files\IBM\Trace Facility\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\


Remember, the DB2 module is installed in Perl and working correctly when the same script is run from a cmd prompt.

I've searched around, of course, but have not found any suggestions that worked, or even were a good match to my situation. XAMPP / Perl and DB2 is not a very common combination.

Any suggestions?
BradW76
 
Posts: 3
Joined: 19. August 2011 00:23

Re: Perl DB2 module doesn't load for Apache

Postby Sharley » 19. August 2011 01:15

In the \xampp\apache\conf\httpd.conf file there is a section
Code: Select all
# Perl settings
Include "conf/extra/httpd-perl.conf"
This file refers to loading mod_perl that unless you need it should be disabled - comment out this section and then you must restart Apache.

In previous XAMPP versions (1.7.3 etc.) the mod_perl was controlled via a setting in the setup_xampp.bat file but alas this handy inclusion no longer exists, so you have to do it manually.

Mod_perl is enabled by default in 1.7.4> but in my opinion it should be disabled by default and only enabled if it is known to be absolutely needed.

See if disabling mod_perl helps your issue.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Perl DB2 module doesn't load for Apache

Postby BradW76 » 19. August 2011 16:18

Thanks for the reply, but that didn't fix the problem. It changed the symptoms, I no longer get ANY web page displayed, but the same error message is still showing up in the Apache error.log.

Any other ideas?
BradW76
 
Posts: 3
Joined: 19. August 2011 00:23

Re: Perl DB2 module doesn't load for Apache

Postby BradW76 » 19. August 2011 18:30

I found my answer. It was indeed the PATH variable missing the DB2 directories that was the problem, but in a more interesting way than I thought.

After changing the System environment to move the DB2 entries to the front and not having Apache see the new PATH, I found that the Windows Services reads the environment when it starts at boot time, and every service started after that gets the environment (including PATH) that existed at boot time. Since I had not rebooted after installing DB2 and XAMPP, when the Apache service started, it did not see any of the DB2 PATH entries, so when the Perl DB2.dll tried to load the standard DB2 product dll files, it couldn't find them.

Running it in a cmd window worked because that got the current environment, which included the DB2 dirs.

Guess I've been working on Unix too long. Reboot a server just because you installed software? No -c option for Services? How primitive.
BradW76
 
Posts: 3
Joined: 19. August 2011 00:23


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 146 guests