# Update safely

Back up, replace the files, run the update, then check the basics.

<Danger>
**Back up first.** An update replaces the product's files, so changes you made to them are lost. Keep your own changes under version control, and try the update on a staging copy when you can.
</Danger>

Envato emails you when a new version is out. Every product updates the same way:

<Steps>
<Step title="Read the release notes">
Open the [changelog](https://changelogs.qdev.tech/) for the version you're moving to. New requirements and one-off steps are listed there.
</Step>
<Step title="Back up">
Back up the database, the `.env` file, the `storage/` folder and any files you changed.
</Step>
<Step title="Replace the files">
Download the new archive from your Envato downloads, extract it, and copy the contents of its `Script` folder over your site's files. Keep your `.env` file.
</Step>
<Step title="Run the update">
Open `https://your-site.example/update` and follow the update wizard. It applies the database changes the new version needs.
</Step>
<Step title="Check the basics">
Sign in, send a test email, and try the main thing your site does.
</Step>
</Steps>

## Changed the code yourself?

Keep your version in Git, so an update becomes a merge instead of starting over:

1. Keep the code in a **private** repository. A public copy of a paid product gets taken down.
2. Keep your changes on their own branch.
3. Add each new release to the main branch, then merge it into yours and resolve any conflicts.
4. Deploy your merged version and run the update wizard as usual.

## If something goes wrong

<AccordionGroup>
<Accordion title="The installer appears after the update">
The install marker in `storage/app/` wasn't kept. Put your `storage/` folder back from the backup.
</Accordion>
<Accordion title="A 500 error right after updating">
Read the last error in `storage/logs/laravel.log`. Then check the PHP version the new release needs, that the files belong to the web server's user, and that `.env` was restored.
</Accordion>
</AccordionGroup>
