(PHP 7 >= 7.4.0, PHP 8)

SQLite3::backupBackup one database to another database


public SQLite3::backup ( SQLite3 $destination , string $sourceDatabase = "main" , string $destinationDatabase = "main" ) : bool

SQLite3::backup() copies the contents of one database into another, overwriting the contents of the destination database. It is useful either for creating backups of databases or for copying in-memory databases to or from persistent files.

Elenco dei parametri


A database connection opened with SQLite3::open().


The database name is "main" for the main database, "temp" for the temporary database, or the name specified after the AS keyword in an ATTACH statement for an attached database.


Analogous to sourceDatabase but for the destination.

Valori restituiti

Restituisce true in caso di successo, false in caso di fallimento.


Example #1 Backup an existing database

// $conn is a connection to an already opened sqlite3 database

$backup = new SQLite3('backup.sqlite');
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top