2.13.4.12. Generic OpenCart config files
Data config files simplify the site transfer process:
- File
config.php
(located in root directory site):- config.php
<?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_');
- File
config.php
(located in the subdirectoryadmin
):- config.php
<?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/');