Shop transfer live system / test environment

Article Version

5.5.0 or newer

Table of contents

In this article we'll show you how to transfer your test environment to your productive environment and vice versa. Please note, that your server may have different versions of e.g. phpMyAdmin or FTP client, so they may look different.

From Test System to Live System

This shows you how to transfer your test shop into your live system, e.g. after developing.

Copy the files

Open your preferred FTP client and copy the shopware root directory (1) in the main routed directory of your live environment (2). Keep in mind, that you exclude cache directories from the upload, the cache folder can be found in /var/cache.

Copy the database

Open phpMyAdmin in your test system and log in. Choose your test database (1) and click export (2) to export (3) your test database.

Now open the phpMyAdmin of your live system and choose the desired database (1), click import and choose your exported sql file (2) and start the import (3).

It may happen, that your exported file is too big to get it imported at one, when this happens, you have to export your database dump using compression. If the file is still too big for the import, you have to use batch processing tools like BigDump for example to get your sql file imported.

 

Changing the shop URL

To make your shop reachable, you have to change the shop URL in the database. To do this, just open the table s_core_shops (1) and edit the entry of your main shop. In the column "host" you have to change your URL from the test URL to the live URL. Note that this URLS must be entered without http(s)://! According wheather you use your shop in a subfolder, enter this folder in the column "base-path" or clear this value, if you don't use shopware in a subfolder. After doing this, save your changes.

Changing the config.php

Finally you have to connect your file system to your database, this can be done by editing the config.php in shopware's main directory. Just open the file and change the following data to those you got from your hoster (Normally they are the same like your phpMyAdmin credentials):

 


    'username' => 'root',
    'password' => 'root',
    'host' => 'localhost',
    'port' => '3306',
    'dbname' => 'shopware',

 

If you copied the cache files, you now should delete your production_REVISION directories in /var/cache or just execute the clear_cache.sh' script in the cache folder. If you reopen your shop, the new cache files will be created automatically.

 

Permissions of the shopware directories

Now you should open the backend of your shop and open Configuration > System info > Shopware directories. If directories are marked with a red X, just reset the folder permissions to 0755. Except of cache directories, NEVER set permissions to 0777 because this gives everyone read and write access to your data, which shoud be avoid. After this step, clear all caches except SEO and search cache and reload the Shopware backend.

 

Copy a live system into a test system

If you setup yourself a testsystem for programming, we describe how this works.

 

Copy the files

Open your preferred FTP client and transfer the files (excluded the cache folders /var/cache/production_REVISION) from your live system into your test system. Depending on which test system you use, the folder may be different, in Linux systems this is normally in /var/www. Copy all the files and overwrite all files.

Copy the database

Open phpMyAdmin in your live system and log in. Choose your database (1), click on export (2) and export (3) your database.

Now open your local phpMyAdmin and create a new database (1) if needed. Otherwise clear your existing database you want to use.

Now open your database (1) click import (2) and import (3) the live database into the test system.

It may happen, that your exported file is too big to get it imported at one, when this happens, you have to export your database dump using compression. If the file is still too big for the import, you have to use batch processing tools like BigDump for example to get your sql file imported.

 

Changing the shop URL

To make your shop reachable, change the URL in your test database, just open phpyAdmin and open the table s_core_shops (1) in your test database and edit the host (2) to (in the most cases) localhost. If you are using your testshop in a subfolder, you also have to change the base_path (3), otherwise, base_path has to be empty.

Changing the config.php

Finally you have to connect your file system to your database, this can be done by editing the config.php in shopware's main directory. Just open the file and change the following data to those you got from your hoster (Normally they are the same like your phpMyAdmin credentials):

 


    'username' => 'root',
    'password' => 'root',
    'host' => 'localhost',
    'port' => '3306',
    'dbname' => 'shopware',

 

If you copied the cache files, you now should delete your production_REVISION directories in /var/cache or just execute the clear_cache.sh' script in the cache folder. If you reopen your shop, the new cache files will be created automatically.

 

Tips & Tricks

Prevent indexing test systems in the www

If you have your test system on a public webserver, we recommend to avoid indexing by search engines.

 

Activating service mode and restricting by IP

Activate the Service Mode in the shop in Configuration > Basic settings > Settings > Service and restrict the access to your IP, so you can work in your test system. When you don't know your IP, you can check it on e.g. https://www.whatismyip.com/.

 

Prevent the shop of crawling by robots

Create a file named robots.txt in the shopware root directory with the following content:

 


User-agent: *
Disallow: /

This tells every robot to not crawl your shop. If you transfer your shop from Test to live, don't forget to delete this file!