If you are planning to migrate from PrestaShop to another eCommerce platform, sure thing, doing PrestaShop backup should be at the top of your to-do list. With that being said, we still advise those who don’t plan for the store migration to do the backup periodically.
Why so, and how to perform PrestaShop backup anyway? Don’t worry! In this quick tutorial, we will show you all you need to know about backup PrestaShop, including:
- How to back up your PrestaShop’s file and database?
- How to restore your PrestaShop database?
- What should you be aware of when doing the backup?
- Why should you care about backing up your PrestaShop store?
Let’s explore!
How To Properly Backup PrestaShop?
A comprehensive PrestaShop backup would require you to back up your two most important assets: your PrestaShop files and database.
#1. Backup files
First, it's important to save copies of your PrestaShop files. These files include the code that makes your online store work, along with your custom designs, pictures, and other important stuff.
Step 1: Copy your files
To back up your files, ensure that your shop folder is copied to a different location. While it is possible to copy the files to another folder on your server, we highly recommend that you make an additional copy of your files on another computer in case of server failure or data loss.
To do so, you will need to connect to your server using an SSH, FTP, or RDP connection, depending on the type of server and the hosting provider you are using. Once connected, you can copy the files to another location and then download them onto your local computer.
If you are using SSH, you can use the scp or rsync command to back up your shop folder from one server to another. For instance, if you want to back up from a remote server to your local machine (or the one you are currently connected to), you can employ the scp command as follows:
scp -r user@host:/var/www/prestashop_folder_path /local_path_for_backup/
Alternatively, you can use the rsync command, which is also a powerful tool for file transfer (you can check the rsync man page for additional information):
rsync -avz user@host:/var/www/prestashop_folder_path /local_path_for_backup/
Keep in mind that this process may take several hours to complete, depending on the number of files you have and your internet connection. However, if you are an advanced user with complete access to your server, you can speed up the process effectively by compressing your files before downloading, which we will show you next.
Step 2: Compress your PrestaShop files before downloading
As we were saying, downloading the entire PrestaShop folder one file at a time can be a time-consuming task. So if you can run commands on your server, you can compress all your content into a single archive file and download this one file only:
- For Windows-based servers, you will need remote desktop access. Once you are logged into your remote environment, navigate to your www folder using Windows Explorer. From there, you can compress all its contents into a ZIP file, which will make it easier to download.
- For Linux-based servers, you will need to access your server terminal using SSH. After logging in, navigate to your folder and use the command below to create a TAR file:
tar -czf <file_name>.tar <folder_to_save>
For example, if you want to create a backup of your HTML files, you would use:
tar -czf backup.tar /var/www/html
Once your archive is ready, you can then copy it to your computer or any other safe location.
#2. Backup database
Besides your files, you would need to back up the database of your PrestaShop as well. A good PrestaShop database backup should ideally give you a SQL file including both the structure and the content of each table in the database.
There are indeed tons of ways to back up your PrestaShop database (e.g. via a PrestaShop backup module), but we will only cover the two most common methods in this quick tutorial.
#1. Method 1: Use MySQL in the Command Line
The easiest way to make a full backup is using a tool called mysqldump. Here's how:
- Open a command prompt on Windows or Linux.
- Type this command:
mysqldump yourdatabasename > dump.sql (Replace “yourdatabasename” with your actual database name)
You might need to provide login details. If so, use this longer command:
mysqldump –host=<IP_or_hostname> –user=<user> –password –single-transaction –create-options –extended-insert –complete-insert yourdbname > dump.sql
If you don't know your database name or login details, you can find them in these files:
- For back up PrestaShop 1.6: Look in config/settings.inc.php
- For backup PrestaShop 1.7 and later: Check app/config/parameters.php
#2. Method 2: Using phpMyAdmin
Many hosting providers offer phpMyAdmin, which is another way to backup your PrestaShop database through. Here’s the detailed instructions:
- Log into phpMyAdmin
- Select your PrestaShop database
- Click the “Export” tab
4. Choose the “Custom” export method for more options
5. Make sure to select all your tables and views
6. Check these options:
-
- Use LOCK TABLES statement
- Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement
7. Click “Go” to create and download the backup
How to Restore PrestaShop Database?
Should your PrestaShop store crash, getting your data back on ASAP is of utmost importance, especially if you have tons of traffic, orders, customers, etc.
Follow the steps below to restore your PrestaShop backup and pick up where you left off:
- Log in into your PrestaShop dashboard.
- Navigate to “Tools” > Choose “Import” > Then select “Browse”
3. Select the PrestaShop backup file you’ve backed up on your computer and click “Open”.
4. Afterward, choose “Upload” and that’s how you store your PrestaShop store database
What Do You Need To Notice When Backing Up PrestaShop?
From our experience, here are some best practices you should keep in mind to perform a proper PrestaShop backup:
- Backup your entire store: When backing up your PrestaShop store, remember to export your store's full database (using phpMyAdmin or MySQL command line) and copy all files, including themes, modules, and media.
- Automate your backup: If you have a large database and don’t want to spend too much time on manual backup, consider using an automatic backup module to set up daily automated backups for your store.
- Secure your backup: Don't forget to store your backups in multiple locations, including off-site or cloud storage. If you have sensitive data, consider using encryption tools like 7-Zip, VeraCrypt, or GPG (GNU Privacy Guard) to encrypt your PrestaShop backup files before storing them.
- Verify and test: Regularly check backup integrity by performing test restorations in a staging environment. Keep detailed documentation of your backup process for quick recovery if needed.
When Should You Perform Backup PrestaShop?
Performing a PrestaShop backup is crucial task in many circumstances. Below is a few cases when you backing up your PrestaShop store is a must, not a plus:
- Before you migrate to another platform: A complete backup would allow you to transfer all your data, including products, customer information, order history, and customizations, without risking data loss or corruption during the migration process.
- Prior to performing a PrestaShop upgrade: Having a backup before updating PrestaShop allows you to easily revert to the previous working version if issues arise. This minimizes downtime and protects your store from potential data loss during the update process.
- As part of your regular security routine: Regular backups ensure you're prepared for unforeseen events like server crashes, hardware failures, or natural disasters. With a recent copy of your entire PrestaShop store, you can quickly recover and minimize the impact on your business operations.
- When planning to test new features or designs: Before experimenting with new features, modules, or design changes, remember to create a backup to set up a safe testing environment without risking your live store.
Frequently Asked Questions
How to backup Prestashop website?
To backup your PrestaShop website:
- Download all files via FTP, including themes, modules, and images.
- Export your database using phpMyAdmin or MySQL command line
- Store both database and files securely off-site
How do I export data from PrestaShop?
To export data from PrestaShop:
- Log into your PrestaShop admin panel.
- Navigate to Advanced Parameters > Database > SQL Manager.
- Select the tables you want to export.
- Choose the export format (usually SQL).
- Click "Export" to download the data file.
How do I transfer my PrestaShop to another domain?
To transfer PrestaShop to another domain:
- Backup your current site (database and files).
- Upload files to the new domain via FTP.
- Create a new database on the new server.
- Import your backed-up database.
- Update configuration files with new domain and database details.
- Clear cache and regenerate .htaccess file.
How do I clone a PrestaShop website?
To clone a PrestaShop website:
- Create a full backup of your original site.
- Set up a new hosting environment or subdomain.
- Upload the backed-up files to the new location.
- Create a new database and import the backed-up data.
- Update configuration files with new database details.
- Clear cache and test the cloned site thoroughly.
Conclusion
All in all, if you are a PrestaShop store owner, executing proper PrestaShop backup is a task you shouldn’t overlook. Whether you want to migrate from another platform to PrestaShop or vice versa, backing up your files and database could help safeguard your business against potential disasters.
If you think of PrestaShop migration, we highly recommend checking out our PrestaShop migration services for a risk-free and error-free migration experience.
Explore LitExtension’s blog and join our Facebook Community to get all the latest eCommerce news, tips and tricks.