PHP Fatal error: Class 'COM' not found

浪子不回头ぞ 提交于 2019-12-12 14:58:51

问题


I'm getting this error after upgrading PHP to v. 5.5.1:

Fatal error: Class 'COM' not found in
C:\inetpub\wwwroot\ndsystems\database_engine\mssql_engine.php on line 184

Line 184 in mssql_engine.php file:

$this->COMConnection = new COM('ADODB.Connection');    //line 184
try {
    $this->COMConnection->Open($connectionString);
    $this->RetrieveServerVersion();
} catch (com_exception $e) {
    $this->lastError = $e->getMessage();
    $result = false;
}
return $result;

Environment is Windows 2008 R2 SP1, IIS 7

Things I tried:

  1. Added this at the end of php.ini:

    [PHP_COM_DOTNET]
    
    extension=php_com_dotnet.dll
    
  2. Added extension=php_com_dotnet.dll in [PHP] section of php.ini

  3. Rebooted IIS and also rebooted server itself.

  4. Downgraded PHP to 5.3.27

Nothing seems to work. How do I fix this error?


回答1:


In addition to adding

[PHP_COM_DOTNET]
extension=php_com_dotnet.dll

to your php.ini file, you have to tell PHP where to look for the extension, and to enable extensions.

To tell PHP where to look for extensions on Windows just uncomment (remove the leading ;) following line:

extension_dir = "ext"

To enable extensions set the enable flag to On:

enable_dl = On


来源:https://stackoverflow.com/questions/18240521/php-fatal-error-class-com-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!