1.4 Direct Connection through HTTP Tunnel


This section describes how to setup HTTP Tunnel connection in Store Manager for OpenCart.

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

This type of connection is useful if you don’t have direct access to 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.

To configure HTTP Tunnel connection, follow a few steps listed below:

  1. Open your application main directory - usually, it is "C:\Program Files\eMagicOne\Store Manager for OpenCart" 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. The tunnel should be accessible from the web as here - http://www.onlinestore.com/sm_tunnel.php whereas http://www.onlinestore.com is your store URL. If you uploaded file correctly, you will receive the message - “Tunnel script is installed correctly. You can establish connections through the HTTP tunnel.”
  3. Open your store root folder -> includes directory -> and find there global.inc.php file.
  4. Find there the following lines -
    1. $glob['dbhost'] = 'servername.com'; If any is defined here (like 'http://www.servername.com'), you should use the one (servername.com). If it is defined as 'localhost', it means you should use your store name.
    2. $glob['dbdatabase'] = 'remote_database_name'; //your database name is defined here
    3. $glob['dbpassword'] = 'password'; //your password is defined here
    4. $glob['dbusername'] = 'username'; //your User Name (login) is defined here
  1. In your Store Manager open Preferences -> and choose button 'Create the new configuration' and then put the name of the configuration.

2. Next check checkbox - Direct connection through HTTP Tunnel.

3. Specify Database Connection Settings:

4. 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.

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

6. Host, Username (login), Password and Database (name) - specify your hostname, database username, password and database name, which you have found at your config.php file.

Config.php on FTP

You may type database name manually or use 'Select Database' button. It leads to a list of available databases to choose one you need :

Connection through tunnel

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

Test connection option

8. Click 'OK' to save this entry, close Preferences and to connect to your database, or click cancel to discard this entry.

By eMagicOne Inc.