0

我在 Web 主机上安装了一个脚本,但是当我想在 localhost 上安装和运行它时会出现此错误:

setLogPath($config['debugger_log_dir']);
 $debugger->setDebuggerTemplates($config['debugger_template_dir']);
 //Start debugger timer $debugger->measureRunTime();
 // Initialize db object for the queries $db = new Database($db_config);
 //Start settings autocreater $SettingsParser = new SettingsParser(ROOT_PATH . "core/3WFW/Settings.php",&$config);
 $settings = $SettingsParser->load();
 /* if($settings['setting_site_status'] == 'offline'){ $ips = $db->fetchAll("SELECT * FROM `allow_ips`");
 $rIps = array();
 foreach($ips AS $k=>$v){ $rIps[] = $v['ip'];
 } if(!in_array($_SERVER['REMOTE_ADDR'], $rIps)){ echo $settings['setting_offline_message'];
 exit();
 } } */ //set timezone ini_set('date.timezone', $settings['setting_server_timezone']);
 //set cookies session_set_cookie_params($settings['setting_cookie_lifetime']);
 session_regenerate_id();
 //    Start the template system $smarty = new Smarty();
 //$smarty->template_dir = ROOT_PATH . 'application/templates/'. $settings['setting_site_skin'] . '/';
 $smarty->compile_dir = ROOT_PATH . 'temp/cache_template/';
 $smarty->config_dir = ROOT_PATH . 'temp/cache_template/';
 $smarty->cache_dir = ROOT_PATH . 'temp/cache/';
 $smarty->debugging = false;
 $smarty->caching = $settings['setting_smarty_cache_status'];
 $smarty->compile_check = true;
 $smarty->cache_lifetime = $settings['setting_smarty_cache_lifetime'];
 // Start the cache system Loader::loadClass("Cache");
 // Find Out what the user is using Loader::loadClass("Browser");
 $settings['browser'] = Browser::detect();
 // Start the registry Registry::set($db, "db");
 Registry::set($smarty, "smarty");
 Registry::set($debugger, "debugger");
 Registry::set($config, "config");
 Registry::set($settings, "settings");
 Registry::set(new Cache($cache), "cache");
 isset($_SESSION['admin_lang']) ? $admin_lang = $_SESSION['admin_lang'] : $admin_lang = $settings['setting_admin_lang'];
 Registry::set(Language::loadAdmin($admin_lang), "adminlang");
 isset($_SESSION['front_lang']) ? $front_lang = $_SESSION['front_lang'] : $front_lang = $settings['setting_front_lang'];
 Language::initFront($front_lang);
 //    Registry::set(Language::loadFront($front_lang), "frontlang");
 Registry::set(Language::loadFront(), "frontlang");
 //Load SEO Router "OPTIONAL!" Loader::loadClass("Router");
 //Load CMS pages $cms = array('about','careers','faq','payment-methods','terms','privacy- policy','join',' checkoutsucc','checkoutfail','about-us');
 $cms_all = $db->fetchAll("SELECT url FROM cms_page WHERE menu IN ('aboutus', 'aboutyou', 'aboutbusiness','no-menu')");
 foreach($cms_all as $v){ if(!in_array($v['url'], $cms)) $cms[] = $v['url'];
 } $cms = implode('|', $cms);
 $seo_rules['cms']['pattern'] = "/\/({$cms})/i";
 //Start controller system $controller = new Controller();
 $controller->start(Router::checkURL($seo_rules));
 //    end time for script $debugger->measureRunTime();
 // Show //debugger if(false){ if(in_array($_SERVER['REMOTE_ADDR'], $config['developers_ips']) AND empty($_POST)){ $db->showSQLDebugger();
 $debugger->show_debugger();
 } } ?>

我正确编辑了数据库用户名和密码,并将其安装在网络主机上,但在本地无法运行。你能帮助我吗?

4

1 回答 1

0

看起来您正在使用 Smarty 和一些其他库。如果代码未在本地执行,您可能需要检查缓存文件夹的权限。

$smarty->template_dir = ROOT_PATH . 'application/templates/'. $settings['setting_site_skin'] . '/';
$smarty->compile_dir = ROOT_PATH . 'temp/cache_template/';
$smarty->config_dir = ROOT_PATH . 'temp/cache_template/';
$smarty->cache_dir = ROOT_PATH . 'temp/cache/';

您可以编辑原始问题以包含错误消息而不是您用来触发错误的代码吗?它可能会抱怨无法写入缓存目录来编译模板。

于 2013-09-17T01:33:10.833 回答