我从我的网络服务器上完整备份了opencart的数据库。现在我想将它安装在本地主机上,以便我可以在代码上进行更改,并可以在本地测试它。所以我将文件夹复制到本地的根目录中服务器。为其创建了一个新数据库。然后编辑 config.php 文件,如下所示。
<?php
// HTTP
define('HTTP_SERVER', 'http://localhost/sillypunter/ocart/');
define('HTTP_CATALOG', 'http://localhost/sillypunter/ocart/')
// HTTPS
define('HTTPS_SERVER', 'http://localhost/sillypunter/ocart/');
// DIR
define('DIR_APPLICATION', 'sillypunter/ocart/catalog/');
define('DIR_SYSTEM', 'sillypunter/ocart/system/');
define('DIR_DATABASE', 'sillypunter/ocart/system/database/');
define('DIR_LANGUAGE', 'sillypunter/ocart/catalog/language/');
define('DIR_TEMPLATE', 'sillypunter/ocart/catalog/view/theme/');
define('DIR_CONFIG', 'sillypunter/ocart/system/config/');
define('DIR_IMAGE', 'sillypunter/ocart/image/');
define('DIR_CACHE', 'sillypunter/ocart/system/cache/');
define('DIR_DOWNLOAD', 'sillypunter/ocart/download/');
define('DIR_LOGS', 'sillypunter/ocart/system/logs/');
// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'sp_user');
define('DB_PASSWORD', 'sp1234');
define('DB_DATABASE', 'sp_ocar');
define('DB_PREFIX', 'sp_');
?>
但是在浏览器上它给我服务器错误 500。我正在使用 ubuntu 14.04、apache2、mysql 和 php。请帮我解决这个问题。
define('DIR_APPLICATION', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/catalog/'); 定义('DIR_SYSTEM', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/system/'); 定义('DIR_DATABASE', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/system/database/'); 定义('DIR_LANGUAGE', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/catalog/language/'); 定义('DIR_TEMPLATE', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/catalog/view/theme/'); 定义('DIR_CONFIG', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/system/config/'); 定义('DIR_IMAGE', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/image/'); 定义('DIR_CACHE', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/system/cache/'); 定义('DIR_DOWNLOAD', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/download/'); 定义('DIR_LOGS', $_SERVER['DOCUMENT_ROOT'].'sillypunter/ocart/system/logs/');
对于 Windows,配置文件应如下所示:
<?php
// HTTP
define('HTTP_SERVER', 'http://<your host>/');
// HTTPS
define('HTTPS_SERVER', 'http://<your host>/');
// DIR
define('DIR_APPLICATION', 'C:/<path to your directory with files>/catalog/');
define('DIR_SYSTEM', 'C:/<path to your directory with files>/system/');
define('DIR_IMAGE', 'C:/<path to your directory with files>/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/');
记得替换
<path to your directory with files>
和 <your host>
。