我正在使用PHP与MySQL在2003年使用PHP 5.2提取程序,课程等。我正在使用PHP 5.4将我的站点转移到新的2008盒子(因为数据库上的注入攻击)。我的数据仍然从我的新服务器上传到我的网站(程序,课程等)。
问题是我有一个用于登录的页面,不会加载(HTTP 500错误)。我已经追溯到可以解决的代码段,并认为它是session_start()
。我知道在5.3中它改变了,如果它不能启动而不是之前的真实,它将返回false。
我已经尝试回应每个变量逐行加载的内容,因为我可以将它与两个版本进行比较。我尝试在开始时开始会话。在我的代码之前结束它等等。看起来很简单,但我还没有让它工作。
这是我的页面“login-inc-header.php”的开头:
<?php
if(!isset($session_started)) $session_started = session_start();
// avoids duplicate pstings
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
ini_set("display_errors", "1");
if(!isset($requires)) $requires = "User";
include_once("includes/handleLogin.php");
include_once("../includes_app/db_settings.php");
?>
如果我删除此块,页面将在没有我的登录框的情况下加载。页面在5.2版本中完美运行。想法?
我的db_settings:
<?php
//$site_root = "/var/www/html/";
$site_root = "C:\\Inetpub\\wwwroot\\"; //changed 12-13-13 for new server
//$site_root = substr($_SERVER['PATH_TRANSLATED'], 0, (-1 * strlen($_SERVER['PATH_INFO'])));
$site_url = "http://10.20.251.60/";
include_once($site_root."includes_app/adodb/adodb.inc.php");
$db =& ADONewConnection('mysql');
$db->Connect("localhost", "####", "####", "####");
$db->SetFetchMode(ADODB_FETCH_ASSOC);
// for mysql only...make sure we are NOT in strict mode
$db->Execute("SET sql_mode=''");
$tblprefix = "";
$extraFieldLabHours = true;
$extraFieldOBIHours = true;
$extraFieldsPrereqCoreq = true;
$extraFieldProgramRequirements = true;
$maxCourseCodeLength = 4;
$maxCoursePrefixLength = 4; // 11-05-10 added this line to fix prefix length
$exportReport[$site_url.'includes_app/html_word_export.php'] = "Export for Microsoft Word 2007";
$exportReport[$site_url.'includes_app/html_rtf_export.php'] = "Export for Adobe InDesign CS2";
$exportReport[$site_url.'directory/print.php'] = "Export Directory to HTML";
$sysadmin_email = "gntc@gntc.edu";
$extraModuleEmployeeDirectory = true;
$extraModuleCampusAlert = true;
$extraFieldAtAGlance = true;
$areas = array();
$configAreasResult = $db->Execute("SELECT dbName, displayName FROM ".$tblprefix."areas ORDER BY sequence");
while($configRow = $configAreasResult->fetchRow()) $areas[$configRow['dbName']] = $configRow['displayName'];
$program_types = array();
$configProgramTypesResult = $db->Execute("SELECT dbName, displayName FROM ".$tblprefix."program_types ORDER BY sequence");
while($configRow = $configProgramTypesResult->fetchRow()) $program_types[$configRow['dbName']] = $configRow['displayName'];
$extraFieldCampus = array();
$configCampusesResult = $db->Execute("SELECT displayName FROM ".$tblprefix."campuses ORDER BY sequence");
while($configRow = $configCampusesResult->fetchRow()) $extraFieldCampus[] = $configRow['displayName'];
$extraFieldEmployeeOfficeHours = true;
$extraFieldEmployeeBio = true;
$extraFieldEmployeePicture = true;
$extraFieldFoptNumRequirements = true;
$alternateTitleGeneralCoreCourses = "General Core Curriculum";
$alternateTitleOccupationalCourses = "Occupational Curriculum";
$extraModuleCampusAlert = true; // added on 3-10-10 to make campus alert feature work
$alternateTitleEmployeeEducation = "Credentials"; $showBannerID = true;
$deeperMenus = true;
$importModules = array();
$importModules['import_courses_xml.php'] = "Courses XML";
$importModules['import_employees_xml.php'] = "Employees XML";
$extraModuleDivisions = true;
$gntc_local_upload_dir = $site_root."uploads/";
$gntc_web_upload_dir = $site_url."uploads/";
$exportReport[$site_url.'includes_app/phone_sheet_csv.php'] = "Phone Sheet CSV";
?>
日志文件:
[16-Jan-2014 21:17:46 UTC] PHP警告:include_once(包括/ handleLogin.php):无法打开流:C:\ inetpub \ wwwroot \ login \ includes \中没有此类文件或目录第8行的header.php
[16-Jan-2014 21:17:46 UTC] PHP警告:include_once():无法在C中打开'includes / handleLogin.php'(include_path ='。; C:\ php \ pear') :第8行的\ inetpub \ wwwroot \ login \ includes \ header.php
[16-Jan-2014 21:17:46 UTC] PHP警告:include_once(../ includes_app / db_settings.php):无法打开流:C:\ inetpub \ wwwroot \ login中没有此类文件或目录第9行\ includes \ header.php
[16-Jan-2014 21:17:46 UTC] PHP警告:include_once():无法打开包含的'../includes_app/db_settings.php'(include_path ='。; C:\ php \ pear' )在第9行的C:\ inetpub \ wwwroot \ login \ includes \ header.php
[16-Jan-2014 21:17:46 UTC] PHP注意:未定义的变量:第16行的C:\ inetpub \ wwwroot \ login \ includes \ header.php中的标题
[16-Jan-2014 21:17:46 UTC] PHP注意:未定义的变量:第159行的C:\ inetpub \ wwwroot \ login \ includes \ header.php中的标题
我注意到这引用了PEAR,默认情况下没有像旧版本那样安装。这可能是问题吗?
答案 0 :(得分:0)
您已将此作为您的网站根
$site_root = "C:\\Inetpub\\wwwroot\\";
尝试放
$site_root = "http://yourhost/folder_name/"