What might cause segfaults in PDO_ODBC with PHP8?

344 Views Asked by At

The setup is Debian (or more precisely, the php:8.1-apache docker image with is Debian based.) The problem is not new in php:8.1[...], but also occurs on php:8.0[...]

I have the odbcinst1debian2, libodbc1, odbcinst and unixodbc packages installed.

ODBC and its datasource appear to be set up correctly at the command line and I have a data source creatively named "testodbc1" working...

I can validate that this is working, because running 'isql -v testodbc1 ' works, and I can run command line SQL in it.

So, I'm fairly confident the problem is in the PHP->PDO->ODBC chain, not between ODBC and the (remote) database server.

I have the PHP odbc and pdo_odbc extensions installed.

When I try to correct in PHP using the correct ODBC connector, the right username but the wrong password, I get the desired error.

However, when I then use the correct password, the browser tells me that Apache failed, and I get a segfault appearing in the server logs.

The PHP code required to reproduce is very very simple:

error_log("HERE1");
$dsn = "odbc:testodbc1";
error_log("HERE2");
$conn = new \PDO($dsn, "<myusername>", "<mypassword>");
error_log("HERE3");

Which gives the console output:

[php:notice] [pid 22] [client 172.18.0.1:60572] HERE1
[php:notice] [pid 22] [client 172.18.0.1:60572] HERE2
[core:notice] [pid 1] AH00052: child pid 20 exit signal Segmentation fault (11)
0

There are 0 best solutions below