[Editor's note: see <https://www.sqlite.org/backup.html>]
Just a quick note on not being able to open() two databases together and copy the exact info, say for instance to create a backup db. I searched the net for and answer, none of which served. The comment and solution of attaching seems complicated to me. Eventually I worked out that the same result could be more simply accomplished using the copy() function.
<?php
copy("old.db", "new.db");
?>