Creating a sqlite ./db file from a .csv file is simple using sqlite3 from the command line:
.mode csv
.import <csv file> <table name>
.save <db file>
Now I need to move this function to the server side and do the same thing using PHP. After several house of searching it appears that the .mode and .import commands can be parameters on a CREATE TABLE statement, but that's as far as I've even able to go. There's not much documentation because .mode and .import are specific to sqlite so aren't documented with CREATE TABLE.
I'd welcome any pointers on this.
Edit 10/14/2021 --
I've investigated this enough to understand that the right approach is to use the sqlite command line (sqlite3) rather than the PHP sqlite object. Using the command line allows me to feed the various dot commands in from a file, BUT the table name on the .import command is a recent addition, and the version of sqlite installed on my system is 3.17 which doesn't support that. The problem now is how to install a local version of sqlite3. I'll open a separate post for that.