Are PHP pdo and mysqli modules really both required?

We use MariaDB as database and mysqli as connector module. The Matomo system check warns that the pdo module isn’t installed.

Is this really used at all when mysqli is available? At least I do not receive any errors or miss any obvious features.

Probably the test can be adjusted check for either pdo + pdo_mysql or mysqli instead of both, if MySQL/MariaDB is used as database.

I think PDO has less issues than mysqli… Then it i advised to switch to PDO instead of mysqli…

Probably, however, currently it checks for both, which doesn’t make sense to me, but probably I’m wrong.

Have a look at:

Good to know. However, my question here is not whether mysqli or PDO is the better database connector, but whether it is intended that the system check wants both enabled concurrently.

I use mysqli, have PDO completely disabled in PHP, never faced any issues with this, but the Matomo system check has a warning about disabled PDO regardless.

Good question, maybe @innocraft can give more explanation about that?

@MichaIng you may not have any issues, however it is recommended to have PDO enabled. Is there any particular reason you do not want this enabled.

1 Like

No particular reason, besides being perfectionist. I use Wordpress on the same PHP instance, which (sadly still) requires mysqli, and since usually either the one or the other is used (by one application) to connect to the database, not both, recommending to install both extensions alongside each other seems simply wrong.

Since some benchmarks show mysqli being insignificantly faster than PDO, at least performance is not an argument. If there are known issues or even missing features without PDO, then probably the check should indicate this, and recommend to install PDO (+database type connector, like pdo_mysql) instead of mysqli, and not additionally. And if PDO (+database type connector) are installed, it may then not check for mysqli, as it would remain unused.

I don’t think that both extensions are required for Matomo to run.
The code actually always checks if the PDO extension is installed.
In addition there is a check for the configured database adapter (pdo/mysql or mysqli)
I’m not able to say if there is a reason to check it that way. Only checking the configured adapter might possibly be enough though.

1 Like