git is only for your code changes, not user uploads ;)
backup the user & DB data to a different partition or server via scheduled jobs.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I made a site in Laravel where the users can upload some files (for example images). I configuring the backup right now and I'm thinking about how to backup these files?
Should I put these in a cloud filesystem or use git? The files are all in the public folder
I'd just store/upload the images to an AWS S3 bucket and not your local server to begin with. You can turn replication on so they are always backed up in a separate region automatically, and no need to manually back them up.
We do this with our images, as well as use their database services that do the same thing, so we don't have to backup our images or db. We do keep a monthly snapshot of the db separate just in case, but have NEVER needed to restore a backup in the 6 years we've been doing it. The db has failed once, due to a hardware problem on that physical server (it happens!), and I'm sure glad we used that service, because AWS automatically switched to the backup db almost instantly while it rebuild the main db in the background. We only had about 2 minutes of actual downtime. Had that been our only db instance and we had to restore it from files, that literally could have taken 5 or 6 HOURS (we have a lot of data).
The only thing we have on our app servers, is the actual code. No assets or data. We can just throw away a server, build up a new on, deploy our code and away we go. All in a few minutes. If you have to restore tons of images and the database, that process could take a very long time.
Please or to participate in this conversation.