我有一个安装在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();
} } ?>
我正确编辑了db用户名和密码,我在web主机上安装了它,但在本地运行它。你能救我吗?
答案 0 :(得分: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/';
您是否可以编辑原始问题以包含错误消息,而不是您用于触发错误的代码?它可能抱怨无法写入缓存目录来编译模板。