CityHost.UA
Help and support

Universal config.php for OpenCart

For your convenience, we suggest using the universal configuration files config.php and /admin/config.php . The universal configuration allows you to use a test domain , connect an SSL certificate , and perform site migration from one hosting to another without the need to change the configuration files every time, clearly specifying the paths to files and folders on the hosting and changing the domain in case of renaming the site or using a test domain.

pay attention

  1. When using the universal config, we strongly recommend making a backup copy of the site's original config files, for example renaming them to old_ config.php or downloading them to your computer.
  2. Do not confuse the config files, there are 2 of them and they are different — one for the site, the other for the admin. Using the wrong config files can break the site.
  3. In both config files, in their lower part, there is a section // BD - here you must specify the connection data to the database of your site on the hosting, replacing USERNAME , PASSWORD and DATABASE with your own data from the MySQL settings .
  4. Use the file manager to edit site configuration files.

1 config.php file

 <?php $url = $_SERVER['HTTP_HOST']; $path = dirname(__FILE__); // HTTP & HTTPS define('HTTP_SERVER', 'http://' . $url . '/'); define('HTTPS_SERVER', 'https://' . $url . '/'); // DIR define('DIR_APPLICATION', $path . '/catalog/'); define('DIR_SYSTEM', $path . '/system/'); define('DIR_IMAGE', $path . '/image/'); define('DIR_STORAGE', DIR_SYSTEM . 'storage/'); define('DIR_LANGUAGE', DIR_APPLICATION . 'language/'); define('DIR_TEMPLATE', DIR_APPLICATION . 'view/theme/'); define('DIR_CONFIG', DIR_SYSTEM . 'config/'); define('DIR_CACHE', DIR_STORAGE . 'cache/'); define('DIR_DOWNLOAD', DIR_STORAGE . 'download/'); define('DIR_LOGS', DIR_STORAGE . 'logs/'); define('DIR_MODIFICATION', DIR_STORAGE . 'modification/'); define('DIR_SESSION', DIR_STORAGE . 'session/'); define('DIR_UPLOAD', DIR_STORAGE . 'upload/'); // DB define('DB_DRIVER', 'mysqli'); define('DB_HOSTNAME', 'localhost); define('DB_USERNAME', 'USERNAME'); define('DB_PASSWORD', 'PASSWORD'); define('DB_DATABASE', 'DATABASE'); define('DB_PORT', '3306'); define('DB_PREFIX', 'oc_');

2 file /admin/config.php

 <?php $url = $_SERVER['HTTP_HOST']; $path = dirname(dirname(__FILE__)); // HTTP & HTTPS define('HTTP_SERVER', 'http://' . $url . '/admin/'); define('HTTP_CATALOG', 'http://' . $url . '/'); define('HTTPS_SERVER', 'https://' . $url . '/admin/'); define('HTTPS_CATALOG', 'https://' . $url . '/'); // DIR define('DIR_APPLICATION', $path . '/admin/'); define('DIR_SYSTEM', $path . '/system/'); define('DIR_IMAGE', $path . '/image/'); define('DIR_STORAGE', DIR_SYSTEM . 'storage/'); define('DIR_CATALOG', $path . '/catalog/'); define('DIR_LANGUAGE', DIR_APPLICATION . 'language/'); define('DIR_TEMPLATE', DIR_APPLICATION . 'view/template/'); define('DIR_CONFIG', DIR_SYSTEM . 'config/'); define('DIR_CACHE', DIR_STORAGE . 'cache/'); define('DIR_DOWNLOAD', DIR_STORAGE . 'download/'); define('DIR_LOGS', DIR_STORAGE . 'logs/'); define('DIR_MODIFICATION', DIR_STORAGE . 'modification/'); define('DIR_SESSION', DIR_STORAGE . 'session/'); define('DIR_UPLOAD', DIR_STORAGE . 'upload/'); // DB define('DB_DRIVER', 'mysqli'); define('DB_HOSTNAME', 'localhost'); define('DB_USERNAME', 'USERNAME'); define('DB_PASSWORD', 'PASSWORD'); define('DB_DATABASE', 'DATABASE'); define('DB_PORT', '3306'); define('DB_PREFIX', 'oc_'); // OpenCart API define('OPENCART_SERVER', 'https://www.opencart.com/');

Similar articles