Skip to content

Conversation

@prashanthca
Copy link

@prashanthca prashanthca commented Nov 5, 2025

Thank you so much for the work on the plugin, it's a treat to setup and use!

The issue this PR is trying to solve surfaced while using a static build of PHP and PHP-FPM (v8.4.14) built using @crazywhalecc/static-php-cli. I'm using the "bulk" pre-built version of the PHP and PHP-FPM binaries, which contains pretty-much all of the essential PHP extensions built-in, including SQLite.

But unfortunately the wordpress setup crashes with "PDO Driver for SQLite is missing", after installing the sqlite-database-integration plugin (and following through with the necessary steps).

Checking through the code, I found that the SQLite PHP extension is detected by checking for the pdo_sqlite extension, while the SQLite extension built-into the static PHP build is called: sqlite3.

Replacing all occurrences of "pdo_sqlite" with "sqlite3" in the extension source code fixes the problem. But instead of replacing strings, this PR changes the logic, wherever used, to crash only if neither of the PHP extensions are installed

@prashanthca prashanthca closed this Nov 5, 2025
@prashanthca prashanthca reopened this Nov 5, 2025
@JanJakes
Copy link
Member

Hi @prashanthca!

This project uses the pdo_sqlite extensions, not sqlite3. These are different, independent APIs. See:

The issue this PR is trying to solve surfaced while using a static build of PHP and PHP-FPM (v8.4.14) built using @crazywhalecc/static-php-cli. I'm using the "bulk" pre-built version of the PHP and PHP-FPM binaries, which contains pretty-much all of the essential PHP extensions built-in, including SQLite.

I just checked this and downloaded a macOS build for the "bulk" PHP 8.4 bundle version. Doing some tests:

./php -r "var_dump(extension_loaded('pdo'));" // true
./php -r "var_dump(extension_loaded('pdo_mysql'));" // true
./php -r "var_dump(extension_loaded('pdo_sqlite'));" // false
./php -r "var_dump(extension_loaded('sqlite3'));" // true

It would appear that the "bulk" bundle doesn't include the pdo_sqlite extension.

However, as you mention, I can see that this works:

./php -r "var_dump((new PDO('sqlite::memory:'))->query('SELECT sqlite_version()')->fetch());"

It looks like the extension is included, but it's not being correctly reported. Indeed:

./php -r "phpinfo();" | grep pdo_sqlite
-- no results

That is strange. It looks like an issue with the static-php-cli project. Looking closer, it seems that the pdo_sqlite extension is not meant to be included in the bulk bundle, as it is not listed in https://static-php-cli.fra1.digitaloceanspaces.com/static-php-cli/bulk/build-extensions.json. I don't know why it seems to work then, but I can only recommend opening an issue in the static-php-cli project and checking with them.

Please let me know if we can close the issue on our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants