title: Writing a SQLite db loaded using :memory to disk
body: <p>I'm generating quite a substantial (~50Mb) SQLite3 database in memory that I need to be able to write to disk once the generation of said database is complete. What is the best way of approaching this using PHP?</p>
  
  <p>I have tried creating a structurally identical SQLite3 db on disk, and then using INSERTS to populate it, but it is far too slow. I have also drawn a blank looking at the online <a href="http://www.php.net/manual/en/book.sqlite3.php" rel="nofollow">PHP SQLite3 docs</a>.</p>
  
  <p>What I have found is the <a href="http://www.sqlite.org/backup.html" rel="nofollow">SQLite3 Backup API</a>, but not sure how best to approach interfacing with it from PHP. Any ideas?</p>