2017-06-12 40 views
0

我有多個MS Access數據庫放在Linux Web服務器上,它由GoDaddy託管。但是當我嘗試通過我的登錄門戶登錄時,它給了我錯誤:致命錯誤:未在第11行上的/home/buerer/public_html/flames/events/checklogin.php中找到類'COM'致命錯誤:在PHP 5.6中找不到類'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文件中,沒有人知道如何解決這個問題?

+3

COM類是僅限Windows的擴展。你對nix服務器有什麼期望? –

+0

是的,我可以@ webDev – Bowen

+0

檢查此鏈接訪問php.ini文件https://stackoverflow.com/questions/16140917/how-to-access-the-php-ini-file-in-godaddy-shared-hosting -linux –

回答

0

從PHP 5.4.5,COM和DOTNET不再內置core.you必須在php.ini中添加COM支持PHP:

[COM_DOT_NET] 延長= php_com_dotnet.dll 否則就會請在錯誤日誌中查看此錯誤:致命錯誤:找不到類「COM」

+1

由於OP添加了標籤'linux',我認爲這是他的操作系統,所以你也可以提到'COM'擴展在nix系統上不可用。 –

+0

你知道我可以在Linux網絡服務器上訪問我的php.ini文件嗎? phpinfo.ini中的路徑不存在。 – Bowen

+0

在大多數情況下'/etc/php.ini' – webDev

相關問題