In this tutorial we will describe how to backup your shop. To make full copy of PrestaShop we will need duplicates files stored on server and in database.
There is no need to do copy of your PrestaShop backup in maintenance mode but we recommend it. During this operation you shouldn't make any changes in your shop. A gap between making files and database copy should be as short as possible. Please remember that you follow instructions from this tutorial by your own risk.
First method to backup your files is to use SSH client. This method is fast, but requires access to SSH protocol and some technical knowledge. If you are not sure if you have access via SSH, you can always ask your hosting provider about it. If this solution is not for you, we recommend to make files copy using FTP method which is described below.
Following instruction was written for Windows users. Mac users can use terminal (basic commands, SSH commands)
If you don't have Putty installed on your computer, go ahead and download it here. This old looking application will allow you to make operations via SSH.
After you download one of the versions (32 or 64 bits), you have to install it. After you finish, launch it (you may need to start program as an administrator if you want to save settings).
When you open Putty you should see small configuration window. Fill in “Host Name (or IP address)” field. Often this is just your domain name, like prestapros.com. Port is usually set to 22, but if your hosting provider set a different one, please change this value.
If logging in requires keys, you can set it in . Usually pair login – password is enough, but if keys are required you can set this in Connection->SSH->Auth.
If you want to save settings for later, fill in “Saved Sessions” name and press “Save” button. To start connection press “Open” button.
Now you should see a black window asking you for username and password. Type in your SSH login and press enter. Do the same operation with a password. If everything went well you should be able to execute commands on your server.
Find localization of PrestaShop files. Often such a files can be found in catalogs named after domain. To go up in the structure execute cd .. + enter, to go to a specific folder type cd catalog_name + enter. “Tab” key is useful for auto complete catalogs names.
If you have any problems with finding a right folder, you can always try to contact your hosting provider. Alternatively you can try to find back office catalog name (in many cases it is unique). i.e. if your PrestaShop back office link is like this: prestapros.com/admin123456, than you should search for “admin123456” catalog. After you reach the right path you can check file sizes to ensure that you have enough space to make a copy or you can just zip files. To check how much space PrestaShop takes on hard disk you can run this command inside folder:
du -sh -- *
If you are ready to compress and copy files go a folder up than your PrestaShop files are, and execute:
zip -r name.zip catalog_name
name.zip will be a name of compressed PrestaShop and catalog_name is a folder containing files to be zipped (often public_html or domain name). If command does not work try this one:
tar -czf name.zip catalog_name
After this operation, save file on your computers drive. You can do it by one of the ftp clients, like Filezilla. Obviously you will need login and password to connect to a server.
The easiest method to do the copy of PrestaShop is to use ftp and copy files to a local drive. Unfortunately this is not a perfect solution. First of all coping will take a while (about an hour or so, but it depends on many factors). Secondly, files can be downloaded with errors or even omitted.
Start with downloading and installing any ftp clints like filezilla (available on Windows and Mac). Now fill in fields required for a quick connect (view an image below):
When you are ready press “Quickconnect” button. If everything went fine, you are ready to make operations on your server.
Next step is to find a folder with PrestaShop files. If you have no idea how to do it, you can try method described in SSH method (with finding admin catalog) or just contact your hosting provider.
After you find catalog containing PrestaShop files just drag and drop it from right window (source) to the left one (destination). Alternatively you can press right mouse button and press “download”. Copying files will start automatically and it will take a while.
To make a copy of database we will use very popular web application named phpmyadmin. We will need an url where program is available. Often it is like www.your_domain.com/phpmyadmin. If address does not work, you can search for it in your hosting provider documentation.
Next step is to find your PrestaShop database access. It can be done easily by opening one of the files that we previously downloaded:
Path to database configuration file PrestaShop 1.7: app/config/parameters.php
Path to database configuration file PrestaShop 1.6:1.6 config/settings.inc.php
<?php define('_DB_SERVER_', 'localhost'); define('_DB_NAME_', 'prestapros'); define('_DB_USER_', 'root'); define('_DB_PASSWD_', 'some_password');
Now open your file and find user and password data. Copy those values to phpmyadmin login page.
After logging in you will see phpmyadmin panel. If in the left column you don't see list of PrestaShop tables, you should click on database name to make it active.
Go to “export” tab and check if you see information about exporting tables from you i.e.: Exporting tables from "prestapros16" database. We will use default setting which can be seen below:
If everything seems to be ok, press „Go”. Export can take a while. After it is finished save it on your hard drive. You can check its size or even try to open it (option for advanced users).
In case when your database is too big, you can try to export tables in packages or copy just “create” commands without tables contents. If you want to check size of your tables you can execute this code (source)
SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "database_name_to_change" ORDER BY (data_length + index_length) DESC;
Please replace "database_name_to_change" with your own database name.
We are done. You already have database and files.