Make it work with PHP built with static-php-cli #283
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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