gpt4 book ai didi

升级到 5.4 时 PHP 失败

转载 作者:行者123 更新时间:2023-11-29 03:36:19 24 4
gpt4 key购买 nike

我正在使用 PHP 和 MySQL 在装有 PHP 5.2 的 2003 机器上提取程序、类(class)等。我正在将我的网站转移到一个新的 2008 框与 PHP 5.4(因为对数据库的注入(inject)攻击)。我的数据仍然从我的新服务器提取到我的站点(程序、类(class)等)。

问题是我有一个用于登录但不会加载的页面(HTTP 500 错误)。我已经追溯到踢出的代码部分,并相信它是 session_start()。我知道在 5.3 中它发生了变化,现在如果启动失败将返回 false 而不是之前的 true。

我尝试逐行回显每个变量加载的内容,因为我可以将它与两个版本进行比较。我试过从一开始就开始 session 。在我的代码之前结束它等等。看起来很简单,但我还没有让它工作。

这是我的页面“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");
?>

如果我删除此 block ,该页面将在没有我的登录框的情况下加载。 Pages 在 5.2 版本中完美运行。想法?

我的数据库设置:

<?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 Warning: include_once(includes/handleLogin.php): failed to open stream: No such file or directory in C:\inetpub\wwwroot\login\includes\header.php on line 8

[16-Jan-2014 21:17:46 UTC] PHP Warning: include_once(): Failed opening 'includes/handleLogin.php' for inclusion (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\login\includes\header.php on line 8

[16-Jan-2014 21:17:46 UTC] PHP Warning: include_once(../includes_app/db_settings.php): failed to open stream: No such file or directory in C:\inetpub\wwwroot\login\includes\header.php on line 9

[16-Jan-2014 21:17:46 UTC] PHP Warning: include_once(): Failed opening '../includes_app/db_settings.php' for inclusion (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\login\includes\header.php on line 9

[16-Jan-2014 21:17:46 UTC] PHP Notice: Undefined variable: title in C:\inetpub\wwwroot\login\includes\header.php on line 16

[16-Jan-2014 21:17:46 UTC] PHP Notice: Undefined variable: title in C:\inetpub\wwwroot\login\includes\header.php on line 159

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

最佳答案

您已将此设置为您的站点根目录

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

尝试放置

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

关于升级到 5.4 时 PHP 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21169626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com