gpt4 book ai didi

php - fatal error : Class 'COM' not found in php 5. 6

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:20:06 25 4
gpt4 key购买 nike

我在由 GoDaddy 托管的 Linux Web 服务器上放置了多个 MS Access 数据库。但是当我尝试通过我的登录门户登录时,它给我错误: fatal error :在第 11 行的/home/buerer/public_html/flames/events/checklogin.php 中找不到类“COM”

这里是 checklogin.php 文件的代码:

<?php
session_start();
ini_set('display_errors', 1); error_reporting(E_ALL);
global $rs;
// parse username and password sent from signup form post to php variables
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$access = realpath("db/users.mdb");
$_SESSION['accessLevel'] = "READ DATA FROM TABLE";
//create connection as COM object
$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
//create recordset as new COM object
$rs = new COM('ADODB.Recordset') or exit('Cannot create recordset.');
//dim connection with driver and password
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$access;Jet OLEDB:Database Password='softball1234';");
//$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$access;Jet OLEDB:Database Password=$mypassword;");
$sql = "SELECT * FROM tblUsers WHERE VendorCode='$myusername' and Password='$mypassword'";
//execute sql in connection to database to store are recordset
$rs = $conn->Execute($sql);


if ($rs->EOF) {
echo "Wrong Username or Password";
print "<br>Click <a href=main_login.php>here</a> to try again.";

//print $rs->ErrorMsg(); // Displays the error message if no results could be returned
}else{
$_SESSION['AccessLevel'] = $rs->fields["AccessLevel"]->value;
$_SESSION['MailingListID'] = $rs->fields["MailingListID"]->value;
$count = 0;
while (!$rs->EOF) {
$count++;
$rs->MoveNext();
} //while !$rs->eof

if($count>0){
// Register $myusername, $mypassword and AccessLevel and redirect to file "selection.php"
$_SESSION['username'] = $myusername;
$_SESSION['password'] = $mypassword;


//$_SESSION['AccessLevel'] = $rs->fields["AccessLevel"]->value;

header("location:selection.php");
}else {

echo "Wrong Username or Password";
print "<br>Click <a href=main_login.php>here</a> to try again.";
session_destroy();
}
}
?>

我在 GoDaddy 文件管理器中找不到 php.ini 文件,有人知道如何解决这个问题吗?

最佳答案

从 PHP 5.4.5 开始,PHP 核心不再内置 COM 和 DOTNET。您必须在 php.ini 中添加 COM 支持:

[COM_DOT_NET]扩展=php_com_dotnet.dll否则,您将在错误日志中看到: fatal error :找不到“COM”类

关于php - fatal error : Class 'COM' not found in php 5. 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44507854/

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