Search code examples
phppdodb2php-extension

PHP DLL Extensions not loading - "The specified module could not be found"


I downloaded the pdo_ibm and ibm_db2 extensions for PHP and have placed them in the /ext folder (as .dll for Windows). After that, I go to php.ini and add the following lines (without the ';'):

extension=ibm_db2
extension=pdo_ibm

After trying to run any program, or doing a simple php -v, the following messages are displayed:

C:\Users\jzafrilla\Desktop\xampp\php>php -v

PHP Warning:  PHP Startup: Unable to load dynamic library 'ibm_db2' (tried: \Users\jzafrilla\Desktop\xampp\php\ext\ibm_db2 (The specified module could not be found.), \Users\jzafrilla\Desktop\xampp\php\ext\php_ibm_db2.dll (%1 is not a valid Win32 application.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'ibm_db2' (tried: \Users\jzafrilla\Desktop\xampp\php\ext\ibm_db2 (The specified module could not be found.), \Users\jzafrilla\Desktop\xampp\php\ext\php_ibm_db2.dll (%1 is not a valid Win32 application.)) in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_ibm' (tried: \Users\jzafrilla\Desktop\xampp\php\ext\pdo_ibm (The specified module could not be found.), \Users\jzafrilla\Desktop\xampp\php\ext\php_pdo_ibm.dll (%1 is not a valid Win32 application.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'pdo_ibm' (tried: \Users\jzafrilla\Desktop\xampp\php\ext\pdo_ibm (The specified module could not be found.), \Users\jzafrilla\Desktop\xampp\php\ext\php_pdo_ibm.dll %1 is not a valid Win32 application.)) in Unknown on line 0

PHP 7.2.34 (cli) (built: Oct  1 2020 10:24:14) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

After checking a phpinfo(); file, they don't appear as activated modules/extensions, nor when I type php -m into the cmd.

Have tried adding the lines to php.ini-production and php.ini-development. Have also tried to change the extension_dir bit in the php.ini file, to absolute and dynamic routes, but still, it doesn't find them. I have checked that the .dlls are for this php version (7.2.34). I don't have any other php instance installated, since the path at the phpinfo() page shows the correct route. Yes, after every change I do restart both XAMPP and the php localhost server to see if it works, but the errors are displayed even while everything is turned off. Any clues?


Solution

  • The error message:

    \Users\jzafrilla\Desktop\xampp\php\ext\php_ibm_db2.dll (%1 is not a valid Win32 application.)

    actually means that there is an architecture mismatch between PHP and the DLL (32 vs 64 bits).

    Your PHP is compiled as a 64-bit binary, so it will only work with 64-bit extensions.