tags:

views:

256

answers:

3

I'm trying to connect to a DB2 databse from a windows machine using XAMPP.

When I try to load the php_ibm_db2 module I get the following error

"PHP Startup: ibm_db2: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match"

How do I fix this and connect to a db2 database?

A: 

You have different "versions": 20060613 and 20090626

Did you compile these by yourself? Re-compile it.

Tim
Whoops, I should read more carefully. Your versions does not match.How do you load the module?
Tim
+1  A: 

This means you are trying to use an old (it seems : it's from 2006) version of the imb_db2 .dll file, with a recent (it's from 2009) version of PHP. You should use the same version for both PHP and the extension.

There is a recent version of some extensions .dll available from http://downloads.php.net/pierre/ ; amongst those, there is a couple of versions of php_ibm_db2.dll 1.8 ; with a bit of luck, maybe they'll match your version of PHP -- and there are versions for both PHP 5.2 and 5.3.

Pascal MARTIN
I used one of those versions and put it in the ext directory where PHP is looking for extensions.I now get this error"PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_ibm_db2.dll' - The specified module could not be found."I've restarted XAMPP, double checked to make sure the module is in that directory (it is).Why isn't it being found?
silent1mezzo
Humph, not good (and I don't have any windows machine here, so I can't test by myself) ;; did you use the version (i.e. ts vs non-ts that matches your version of PHP ? )
Pascal MARTIN
I tried both. Same results.
silent1mezzo
Oh :-( Sorry, then, I can't help you much more ; maybe you'll have more luck with another answer... Good Luck !
Pascal MARTIN
"module could not be found" is Windows' lovely little way of telling you there's a runtime dependency (DLL) missing. Use a tool like Dependency Walker to open C:\xampp\php\ext\php_ibm_db2.dll and see what the missing DLL is - there's usually a 'client library' component to these (libpq for PgSQL, libmysqlclient for MySQL, dblib for MSSQL, etc.)
TML
A: 

The top answer got close but didn't have the right php_ibm_db2.dll I needed for PHP 5.3.2 VC9 (windows) NTS (non-thread-safe). But I found one that has it - and many more! Link:

PHP IBM DB2 DLLs on SourceForge via Technology Explorer for DB2

MikeC