Sqlite database corrupts everytime I upload/download it from/to the server

Website URL

My website is https://ducks0ci3ty.ga

Error Message

Sqlite database disk image is malformed

When does this happen

Every time I upload a working sqlite database to the server I see this error as a PHP error.
Every time I download a working sqlite database (generated by the server) from the server I see the specified error every time I try to access the database from the official sqlite3 CLI or even Sqlite Batabase Browser on my computer.

What temporary solutions I found

Dump the working database and create the database on the server using the previous generated dump file.


The database name is .common.db
You won’t see any error in my website.

I would be glad if someone could tell me what should I do.

Maybe your SQLite database file size exceeds 10 MBs which is the file size limit. To fix that problem you need to change the database driver from SQLite to MySQLi or PDO with MySQL, create a new MySQL database, connect to it using the new database host and database name you can find on the “MySQL Databases” section of the Control Panel along with the hosting account username and password which can be found on the same page of the Client Area on where you opened the Control Panel, then scrolling down to Account Details and clicking on “Show/Hide” to show the password, and then convert all SQLite rules to MySQL queries to execute (or the software you’re using will convert them automatically) and then your website will work fine.


My sqlite database file has 4MB.

I’m sorry, but I don’t fully understand the situation.

You say the SQLite database is generated on the server, but you also upload it to the server? And how exactly do you try to access it, and which tool shows this error message? You say it’s a PHP error, but you say you’re using the sqlite3 CLI?

I said I tried both.
But by the time of this message the database I am using was generated in your server.
On my computer I use sqlite3 CLI to see the error and on your server I saw the error on PHP logs.

I’m sorry, but tried both of what? The creation/upload or PHP/CLI access? Or both?

Could you please provide step by step reproduction process I can try to reproduce this issue?

I will go by parts.

How can you reproduce the issue?

Download my sqlite database file (.common.db) and try to read it using any software. You will see an error saying the database disk is malformed.

How can you reproduce the issue? (2nd option)

Create a sqlite file on your computer and upload it to the server, replacing .common.db
You will see a php error in my website saying that the database is corrupted.

Has that a dot at first of file name? files starting with dot cannot be accessible (by softwares) in Linux afaik, you should remove the first dot.

It was a default name assigned by the software but I will change the code if that leads to a correct behaviour. Thank you for the help

I did some testing but could not reproduce the issue. I created a database on my computer, upload it to the hosting account, inserted some values to the table, read some values from the table, and downloaded the updated file. On my own computer, I could read the newly inserted values without any issues.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.