1.10 Direct Connection through HTTP Tunnel

fmPreferences

This section describes how to set up HTTP Tunnel connection in Store Manager for Prestashop.

HTTP tunnel is an alternative way of connecting to your database. It possesses the advantages of both direct and bridge connections.

This type of connection is useful if you don’t have direct access to the MySQL database. Also, you don’t need to do POST \ GET operations to synchronize data with your store; all changes will be reflected in real-time.

Steps to configure HTTP Tunnel connection

  1. Open your application main directory. Usually, it is "C:\Program Files\eMagicOne\Store Manager for Prestashop" and find directory "Service" there. Inside this directory, you can find sm_tunnel.php file.

  2. Copy sm_tunnel.php file to your online store root (catalog) directory via FTP.

For PrestaShop up to 1.6.x, open your store root folder -> config directory -> and find there the settings.inc.php file. Define the following parameters:

      • define('_DB_SERVER_', 'localhost')

            • If localhost is specified here, you should use your store URL (without http://www) in the appropriate field of Store Manager settings.

      • define('_DB_NAME_', 'your_database_name_goes_here')

      • define('_DB_USER_', 'your_user_goes_here')

      • define('_DB_PASSWD_', 'your_database_password_goes_here')

      • define('_DB_PREFIX_', 'ps_')

Save changes and close the file.

For PrestaShop 1.7.x, open store root folder -> app directory -> config directory -> parameters.php

Define the following parameters:

      • 'database_host' => 'localhost',

      • 'database_name' => 'your_database_name_goes_here',

      • 'database_user' => 'your_user_goes_here',

      • 'database_password' => 'your_database_password_goes_here',

      • 'database_prefix' => 'ps_',

Save changes and close the file.

The tunnel should be accessible from the web, like here - http://www.onlinestore.com/sm_tunnel.php, where http://www.onlinestore.com is your store URL.

If you uploaded the file correctly, you will receive the message: “Tunnel script is installed correctly. You can establish connections through the HTTP tunnel.”

  1. In Store Manager, open Preferences -> Actions -> Create a new configuration or press the relevant button in the "Preferences" window and then put the name of the configuration.

Create new configuration

5. Next select checkbox - "Direct connection through HTTP tunnel"

HTTP tunnel

6. Specify Remote Database Connection Settings:

    • "Tunnel address". Specify tunnel address, it should look like http://www.onlinestore.com/sm_tunnel.php where - http://www.onlinestore.com - is your store URL (as an example).

    • "Port" - 3306 is used in most cases (please ask your hosting provider to check if the one is used)

    • "Host", "Username" (login), "Password" and "Database name". Specify your hostname, database username, password, and database name, which you have found at your settings.inc.php file (for PrestaShop 1.7.x the parameters.php file)

Direct connection through tunnel

You may type database name manually or use the browse button to see the list of all available databases and select the one you need from the drop-down.

7. Use the [Test Connection] button to verify if your settings are correct and connection to your remote database is possible.

8. Click [OK] to save this entry and complete the configuration or click [Cancel] to continue. Close "Preferences" to connect to your database.