Apparently package php8.1 is available for ubuntu 22.04 but not available for 20.04. php7.4-sqlite is, however, available for 20.04.
In particular I'd like to use PDO with sqlite on PHP8.1 on 20.04, What are my options to make this happen?
I've already altered /etc/php/8.1/cli/php.ini in anticipation of this working. I found instructions for building libsqlite3.so here - and with that, I was able to compile the library. Then I issued:
sudo mv libsqlite3.so /usr/lib/php/20210902/sqlite3.so
But when I ran php -v, the error log said:
[29-Jul-2023 18:26:13 America/New_York] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20210902/pdo_sqlite (/usr/lib/php/20210902/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/pdo_sqlite.so (/usr/lib/php/20210902/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[29-Jul-2023 18:26:13 America/New_York] PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'sqlite3' in Unknown on line 0
(This is different from the prior error messages, which were:
[29-Jul-2023 18:24:29 America/New_York] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20210902/pdo_sqlite (/usr/lib/php/20210902/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/pdo_sqlite.so (/usr/lib/php/20210902/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[29-Jul-2023 18:24:29 America/New_York] PHP Warning: PHP Startup: Unable to load dynamic library 'sqlite3' (tried: /usr/lib/php/20210902/sqlite3 (/usr/lib/php/20210902/sqlite3: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/sqlite3.so (/usr/lib/php/20210902/sqlite3.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
(And, yes, I understand that even if that had worked, it likely would not have solved the PDO problem.) So I'm not sure how I can proceed to get this functionality for PHP8.1 on Ubuntu 20.04. Is there another package, or maybe a non-standard source from which I can get a working PDO + SQLITE3 (or at least PHP + SQLITE3) installation? Web searches in this case, with the appropriate keywords, have not helped (other than the afore-mentioned library compilation). Or maybe the compile option is still valid but there are steps missing?
EDIT
This was the sqlite3 library compile command:
gcc \
-Wl,-soname,libsqlite3.so.0 \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS3_TOKENIZER \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_JSON1 \
-DSQLITE_ENABLE_LOAD_EXTENSION \
-DSQLITE_ENABLE_PREUPDATE_HOOK \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_SESSION \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_HAVE_ISNAN \
-DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
-DSQLITE_MAX_SCHEMA_RETRY=25 \
-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
-DSQLITE_OMIT_LOOKASIDE \
-DSQLITE_SECURE_DELETE \
-DSQLITE_SOUNDEX \
-DSQLITE_THREADSAFE=1 \
-DSQLITE_USE_URI \
-shared \
-o libsqlite3.so \
-fPIC \
sqlite3.c