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.
This shows you how to transfer your test shop into your live system, e.g. after developing.
Open your preferred FTP client and copy the shopware root directory in the main routed directory of your live environment. Keep in mind, that you exclude cache directories from the upload, the cache folder can be found in /var/cache.
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 (2) and choose your exported sql file (3) and start the import (4).
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.
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 (2) the entry of your main shop.
In the column host (2) 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 (3) or clear this value, if you don't use shopware in a subfolder. After doing this, save your changes.
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.
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.
If you setup yourself a testsystem for programming, we describe how this works.
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.
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 if needed. Otherwise clear your existing database you want to use.
Now open your database (1) click import (2) and select the file for the import (3). After that you can click on Go (4) to import 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.
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 (2) the host to (in the most cases) localhost.
Now change the entries host (2) and base_path (3). In our example, the test environment should be directly accessible under "http://localhost". Accordingly, the entry host must be changed to localhost. Since we do not operate our shop in a subdirectory, the entry base_path (3) must be empty. Then save the changes you have made. 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.
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.
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!