2014-01-16 78 views
2

我在PHP中使用PHP和MySQL一起在2003框中使用PHP来提取程序,课程等。我正在将我的网站转移到一个PHP 5.4的新盒子(因为数据库的注入漏洞)。我的数据仍然从我的新服务器上拉到我的网站(程序,课程等)。PHP升级到5.4时失败

问题是我有一个用于登录的页面,将不会加载(HTTP 500错误)。我已经追溯到部分代码,并相信它是session_start()。我知道它在5.3中改变了,如果它不能开始而不是以前的真实,现在将返回false。

我试过回应一下每个变量逐行加载,因为我可以将它与两个版本进行比较。我已经尝试在开始时开始会话。在我的代码之前结束它,等等。这看起来很简单,但我还没有得到它的工作。

这里是我的页面“登录-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 = "[email protected]"; 
    $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点十七分46秒UTC] PHP的警告:include_once(包括/ handleLogin.php):未能打开流:没有这样的文件或目录在C:\ inetpub \ wwwroot \ login \ includes \ header.php在线8

[16-Jan-2014 21:17:46 UTC] PHP Warning:include_once():包含(include_path ='.; C:\ php \ pear')在C:\ i中打开'includes/handleLogin.php'失败第8行的netpub \ wwwroot \ login \ includes \ header.php

[16-Jan-2014 21:17:46 UTC] PHP Warning:include_once(../ includes_app/db_settings.php):未能打开流:没有这样的文件或目录在C:\ inetpub \ wwwroot \ login \ includes \ header.php在第9行

[16-Jan-2014 21:17:46 UTC] PHP Warning:include_once():Failed opening '../includes_app/db_settings.php'包含在第9行的C:\ inetpub \ wwwroot \ login \ includes \ header.php中包含(include_path ='.; C:\ php \ pear')' -Jan-2014 21:17:46 UTC] PHP注意:未定义变量:第16行的C:\ inetpub \ wwwroot \ login \ includes \ header.php中的标题

[16-JAN-2014 21点17分46秒UTC] PHP说明:未定义变量:标题在C:\的Inetpub \ wwwroot的\登录\包括在线路\的header.php 159

我注意到这个引用的PEAR,它在默认情况下不像旧版本那样安装。这可能是问题吗?

+0

那么接下来你包括包含有一些东西在新的版本中弃用文件(如通过按引用) –

+5

您应该检查写入日志文件的错误并显示使用在那里显示的错误,因为您会看到确切的原因。如果你运行php作为apache模块,然后查看apache错误日志文件。 –

+1

只要你不发布你的错误信息,你很难得到答案。我们都是志愿者,花费我们的晶石时间,所以我们不会通过代码寻找线路来查找错误,特别是如果错误信息与发生这种情况的实际线路可以由您提供。所以,如果你需要帮助,那就投入时间来显示错误信息。 –

回答

0

你已经把这个作为你的站点根目录

$site_root = "C:\\Inetpub\\wwwroot\\"; 

尝试把

$site_root = "http://yourhost/folder_name/"