0

i'm trying to dump a sqLite Database from memory to file (for loggin purposes) but it gives me an error.

I've tried:

conn = new SQLite3("dump.db");
$db->backup( $conn );

but it gives me an error:

Call to undefined method SQLite3::backup() 

I'm using sqLite Version 3.28.0

Any idea how it would work?

1
  • What version of PHP are you running? Commented May 12, 2021 at 12:10

1 Answer 1

1

Your SQLite3 extension is old and doesn't have all the functions (SQLite3::backup has been introduced arround PHP 7.4).

See the manual page: https://www.php.net/manual/en/sqlite3.backup.php

As of SQLite 3.27.0 (2019-02-07), it is also possible to use the statement VACUUM INTO 'file.db'; to backup the database to a new file.

If upgrading is not an option, you can simply use copy().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.