php segmentation fault when connecting to Access database

I have Ubuntu 24.04 and php 8.3. I’m trying to connect to an Access DB through PDO ODBC running on the command line. Here is what I have enabled:

$ php -i | grep PDO 
PDO 
PDO support => enabled 
PDO drivers => mysql, odbc 
PDO Driver for MySQL => enabled 
PDO_ODBC 
PDO Driver for ODBC (unixODBC) => enabled

code:

<?php 
$access_file = './myfile.mdb'; 
$db=new PDO('odbc:Driver=MDBTools; DBQ=' . $access_file . ';'); 
?>

error:

Segmentation fault (core dumped)

That’s all I get, no other information. I am able to connect to and run queries on this mdb file with DBeaver, so the file should be ok. I haven’t been able to find what would cause a Segmentation fault just by creating the PDO connection.

I tried mdbtools. If I run the mdb-ver it returns “JET4”. If I run mdb-sql I can run queries and they return correctly. I also tried “describe table” and it worked correctly, too. So it looks like everything is working correctly with the mdbtools.

I found some old .mdb files that I created years ago for an Access class. I was able to load and run queries on them in DBeaver and work with them using mdb-tools, but again I get the Segmentation fault with them when trying to open them with PHP. It seems to be something specific to PHP.

Faults like this are usually due to mismatched machine code from different versions. From where and how did you obtain and install php and the pdo/odbc drivers?

You max also want to analyse the coredump that has been created, to get more information about the exact situation before the segfault happened.

Segmentation faults can have different reasons, but within standard software under professional QA is is indeed most likely “just” an incompatible version being used.

I installed php 8.3 using apt from the Ubuntu noble-updates, and I installed unixodbc, unixodbc-dev, unixodbc-common, and php8.3-odbc using apt and noble-updates as well. Are these the correct ones?
I also have:
mdbtools/noble,now 1.0.0+dfsg-1.2ubuntu1 amd64 [installed]
odbc-mdbtools/noble,now 1.0.0+dfsg-1.2ubuntu1 amd64 [installed]
@phdr

You should update the mysql driver as well. Even though it’s not used in your script it’s still loaded and can cause such error when wrong version.
You need php8.3-mysql

If that doesn’t help, check ALL currently installed extensions and either disable or upgrade them.

Sponsor our Newsletter | Privacy Policy | Terms of Service