2.14.3.12. Universal OpenCart configuration files

Attention!

The contents of the files are different. Do not copy the contents of one file from another, as this will disrupt the site.

These configuration files simplify the site transfer process:

  • The config.php file (located in the site root directory):
    <?php
    // HTTP
    $host = $_SERVER['HTTP_HOST'];
    define('HTTP_SERVER', 'http://' . $host. '/');
    
    // HTTPS
    define('HTTPS_SERVER', 'https://' . $host. '/');
    
    // DIR
    $dir = dirname(__FILE__);
    define('DIR_APPLICATION', $dir . '/catalog/');
    define('DIR_SYSTEM', $dir . '/system/');
    define('DIR_IMAGE', $dir . '/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', 'example.mysql.tools');
    define('DB_USERNAME', 'example_db');
    define('DB_PASSWORD', 'password');
    define('DB_DATABASE', 'example_db');
    define('DB_PORT', '3306');
    define('DB_PREFIX', 'oc_');
  • The config.php file (located in the admin subdirectory):
    <?php
    // HTTP
    $host = $_SERVER['HTTP_HOST'];
    define('HTTP_SERVER', 'http://' . $host. '/admin/');
    define('HTTP_CATALOG', 'http://' . $host. '/');
    
    // HTTPS
    define('HTTPS_SERVER', 'https://' . $host. '/admin/');
    define('HTTPS_CATALOG', 'https://' . $host. '/');
    
    // DIR
    $dir = dirname(dirname(__FILE__));
    define('DIR_APPLICATION', $dir . '/admin/');
    define('DIR_SYSTEM', $dir . '/system/');
    define('DIR_IMAGE', $dir . '/image/');
    define('DIR_STORAGE', DIR_SYSTEM . 'storage/');
    define('DIR_CATALOG', $dir . '/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', 'example.mysql.tools');
    define('DB_USERNAME', 'example_db');
    define('DB_PASSWORD', 'password');
    define('DB_DATABASE', 'example_db');
    define('DB_PORT', '3306');
    define('DB_PREFIX', 'oc_');
    
    // OpenCart API
    define('OPENCART_SERVER', 'https://www.opencart.com/');
コンテンツ

    (1)