0

I have to test a php application on Windows 10 (version 20H2) with Apache 2.4.54 / PHP 8.1.9 (VS16 x64 Thread Safe) installed.

The informix-client-sdk-4.50.FC8 is installed and the INFORMIXDIR environment variable points to the Informix client SDK installation path.

In the PECL PHP PDO_INFORMIX page (https://pecl.php.net/package/PDO_INFORMIX), I cannot find the Windows dll version of the latest 1.3.6 version of the Informix driver.

In the changelog, I can see that the support for PHP 8.1 version has been added since the 1.3.5 version.

Do you know where I can download the php_pdo_informix.dll file (1.3.5 or 1.3.6) compatible with PHP 8.1.9 ?

I have tried with the php_pdo_informix-1.3.3-7.4-vc15-ts-x64.dll file located at https://github.com/flachglasschweiz/php_pdo_informix/tree/master/x64 but I always have the folling error messages:

  1. At Apache startup: PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_informix' (tried: C:\php8\ext\pdo_informix (Le module sp\xc3\xa9cifi\xc3\xa9 est introuvable), C:\php8\ext\php_pdo_informix.dll (Le module sp\xc3\xa9cifi\xc3\xa9 est introuvable)) in Unknown on line 0

  2. When the php tries to connect to the Informix database: error : could not find driver

Could you please help me?

Thanks and regards.

Lo37
  • 1
  • 1

1 Answers1

1

You need an DLL build for PHP 8.x. One done for 7.x (like the latest one in Flachglasschweiz's repo) will not work as it has a dependecy on php7ts.dll.

You could try building it from source. Quick test with the latest 1.3.6 and VC2019 it appears to works as expected:

C:\php>php --version
PHP 8.1.9 (cli) (built: Aug  2 2022 14:17:26) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.9, Copyright (c) Zend Technologies

C:\php>cat t.php
<?php
try {
$conn = new PDO("informix:database=stores7;server=ids1410;", "informix", "password");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
print "Connected!\n";
$stmt = $conn->query("select tabname from systables");
$res = $stmt->fetch( PDO::FETCH_BOTH );
$rows = $res[0];
echo "tabname: $rows.\n";
} catch (PDOException $e) {
    print $e->getMessage();
}
?>

C:\php>php t.php
Connected!
tabname: systables.

C:\php>

I posted the DLL in one of pending issues here. It appears he has no environment to build the extension any more so building from source would be the best way forward for any Informix PHP user out there ;)

jsagrera
  • 1,978
  • 6
  • 8
  • Hi jsagrera, thanks for your prompt answer. I would like to build the dll from the source located at https://pecl.php.net/get/PDO_INFORMIX-1.3.6.tgz but I am not familiar with C language and the build process. I have followed the instructions located here : https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2. But the nmake returns this error: ..\pecl\pdo_informix\pdo_informix.c(51): error C2059: erreur de syntaxe : '}'. I am using Visual Studio 2022 and I don't know how to configure the C99 support. Have you found a tutorial to build the dll? – Lo37 Aug 24 '22 at 15:34
  • The current PDO Informix code is not that happy with new compilers, but I think you are nearly there. Pretty sure I also got that error while building it. Try commenting out the whole `zend_function_entry` (lines 45 to 52) and replace `pdo_informix_functions` for a `NULL` (line 75). Also, in `informix_statement.c` add a `#include "php_globals.h" – jsagrera Aug 24 '22 at 16:20
  • Thanks again. Ok, done. Some warnings and notes during the nmake but it seems to be ok. Now I have pdo_informix in the module list when I run x64\Release_TS\php -m, but I can't find the php_pdo_informix.dll file: I have some obj, sbr and idb files in the x64\Release_TS\pecl\pdo_informix directory but no dll. Is there a last step to create it? – Lo37 Aug 24 '22 at 16:48
  • run the configure with `--with-all-shared`, like `--enable-pdo --with-pdo-informix=D:\infx\csdk450fc8x2 --with-all-shared`. The .dll should be somewhere in the `Release_TS` dir – jsagrera Aug 24 '22 at 17:00
  • The dll is created, thanks. At Apache startup, I now have: Can't load module '...\\php8\\ext\\php_pdo_informix.dll' as it's linked with 14.31, but the core is linked with 14.29 in Unknown on line 0 (because I want to use the "official" Windows PHP 8.1.9 version with the dll). I have tried to replace the "nmake" with "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe" in order to force the compiler 14.29 but the result is the same... – Lo37 Aug 25 '22 at 13:53
  • Maybe would be simpler to build it with VS2019 (vs16). You can try the one I built to see if it works in your env before wasting time installing VS2019. – jsagrera Aug 25 '22 at 13:57
  • Thanks again for your help! I have tried with your dll, it seems to work (no error in logs at Apache startup) but I have another issue now (SQLDriverConnect: -930), it seems to be endless :( – Lo37 Aug 30 '22 at 08:21
  • PHP Crusade ;) -930 is a "cannot connect", so at least the driver appears to work. I suggest to check first with something like "ilogin.exe" (included in the CSDK directory), to verify the details. After that you can move to test the ODBC driver (which is what PHP uses) creating a DSN using the same details you have in your PHP conn string. – jsagrera Aug 30 '22 at 10:46
  • btw, I'm sure if you use VS2019 instead of VS2022 you should be able to get your own dll. – jsagrera Aug 30 '22 at 10:49