This resolves problems in sqlite when the directory containing the database is not writable by the webserver, even when the database file itself is.