(Just copying my comment that solved @reverendocabron's problem for easy reference.)
The $flags
argument is expected to be SQLITE3_OPEN_READONLY
, SQLITE3_OPEN_READWRITE
and/or SQLITE3_OPEN_CREATE
(whose values are really 1, 2 and 4 respectively) while you give it a Unix-style 0666 argument. In your case, I guess what you're looking for is really SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE
which happens to be the default. Try removing
it.