Updating a Laravel script is safe when you back up first, put the site in maintenance mode, and run the migrations only after the new files are in place. Skip any of those three steps and you are gambling with your database. Follow the order in this guide and your data survives every update.

The updates that went wrong always had the same cause: someone replaced files while the site was live, or ran a migration with no backup to fall back on. The update itself is rarely the problem — the order you do it in is.

What should you back up before updating?

A backup takes ten minutes; rebuilding lost data takes days, if it is possible at all. Before you touch a single file, make two separate backups: one of the database, and one of the files.

  • Database: export a full SQL dump from phpMyAdmin, or run mysqldump from the terminal. This is the backup that matters most — your users, orders, settings and content live here.
  • Files: download the whole project folder, or at least the .env file, the storage folder and any uploaded files. Uploads usually live in storage/app/public, and they are not in the database.
  • Your .env file: back it up separately. It holds your database password, app key and mail settings, and it is the one file an update package never includes.
  • Check the backup: open the SQL file and confirm it is not empty. A 0 KB dump is worse than no backup.

Store the backup outside the project folder — your computer, or a folder above public_html. If the update goes wrong, you do not want your only copy sitting inside the folder you are about to overwrite. The update package itself is always available again, but your data is not — every product ships with full unencrypted source code and lifetime free updates. Browse the full catalogue to check what your licence covers.

Should you put the site in maintenance mode first?

Yes, always. Maintenance mode stops visitors and background jobs from writing to the database while you update. Run this from your project folder before replacing any files:

php artisan down

Visitors see a maintenance page instead of a half-updated site, and no new orders or registrations land in the database while the old code is swapped out. If your script has scheduled tasks, pause those too — a cron job that fires mid-update can write data with the old code while the new code is half in place. Our guide to setting up cron jobs on cPanel explains how those schedules run.

When the update is done and tested, bring the site back with php artisan up. Forget this step and your site stays on the maintenance page while you wonder why nobody can log in.

How do you replace the files without breaking anything?

Do not upload the new version over the old one file by file while the site is running. Upload the update zip to a temporary folder on cPanel, extract it, then move its contents into the project folder, replacing the old files.

Three things need special care. First, never overwrite your .env file with the one from the update package — it is a blank example, and overwriting it wipes your database credentials and app key. Second, never delete the storage folder — it holds your uploads and logs. Third, check whether the update mentions new .env values, such as a new API key, and add those by hand.

After the files are in place, update dependencies if the instructions say so, with composer install --no-dev --optimize-autoloader. Then clear the config, route and view caches — Laravel will happily keep serving the old cached config after an update. A stale config cache causes more "the update did nothing" reports than any real bug; our guide to 9 common errors after installing a Laravel script covers it in detail.

What do migrations actually do to your data?

Migrations change the shape of your database — adding a column, creating a table, renaming a field. A well-written migration adds things without touching your existing rows, which is why updates usually keep your data intact.

The risk is a migration that renames or drops a column. Renaming is safe if the migration copies the data across, but dropping a column deletes that data permanently. If a migration drops something you still need, the backup is your only way back.

Run migrations only after the new files are in place and the config cache is cleared:

php artisan migrate --force

The --force flag is needed on a live server because Laravel asks for confirmation in production. Read the output line by line. If a migration fails, stop — do not run it again blindly. Check the error in storage/logs/laravel.log first. A failed migration halfway through leaves some tables new and some old, and guessing your way out of that is how data gets lost.

How do you test the update before going live?

Test while the site is still in maintenance mode, before you run php artisan up:

CheckWhat to look for
Homepage loadsNo 500 error, styles and images load correctly
Login worksAdmin and a normal user account both sign in
Key pages workThe main features of the script respond normally
Data is intactRecent records, settings and uploads are all still there
Logs are cleanstorage/logs/laravel.log shows no new errors

If your licence covers a staging copy, test there first and repeat the same steps on the live site once staging passes. The Standard licence covers one end product, while the Extended licence covers unlimited end products plus your own SaaS use on a single deployment — the full terms are at license terms.

What if the update goes wrong?

Work backwards. First, read the error — the message in storage/logs/laravel.log usually names the exact file or missing column. Second, check the simple things: config cache cleared, .env intact, storage and bootstrap/cache writable. Most failed updates are one of those three.

If the site is broken and you cannot fix it quickly, roll back: restore the database and the old files from your backup, clear the caches, and bring the site up. That is the whole point of the backup — a bad update becomes a ten-minute restore instead of a lost weekend.

If the rollback works, try the update again later, slowly, once you know what went wrong. If it does not work, contact support with the error log and the exact step where it failed. Our support is a real human on WhatsApp at +92 333 4916432, or by email at contact@zqdevelopers.com, and a refund applies if the product is materially broken and cannot be fixed, within 14 days.

Updating a Laravel script is not risky when the order is right: back up, maintenance mode, replace files, protect .env, migrate, test, then go live. Do it in that order every time and your data will still be there after the update — all of it.