问题描述
将PHP升级到5.5.1版后出现此错误:
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
mssql_engine.php文件中的第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;
环境是Windows 2008 R2 SP1,IIS 7
Environment is Windows 2008 R2 SP1, IIS 7
我尝试过的事情:
-
在php.ini末尾添加了此内容:
Added this at the end of php.ini:
[PHP_COM_DOTNET]
extension=php_com_dotnet.dll
在php.ini的[PHP]部分添加了extension=php_com_dotnet.dll
重新启动了IIS,还重新启动了服务器本身.
Rebooted IIS and also rebooted server itself.
将PHP降级到5.3.27
Downgraded PHP to 5.3.27
似乎没有任何作用.如何解决此错误?
Nothing seems to work. How do I fix this error?
推荐答案
除了添加
[PHP_COM_DOTNET]
extension=php_com_dotnet.dll
在php.ini
文件中,您必须告诉PHP在哪里寻找扩展名并启用扩展名.
to your php.ini
file, you have to tell PHP where to look for the extension, and to enable extensions.
要告诉PHP在Windows上的扩展名,只需取消注释(删除开头的;
),即可:
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
这篇关于PHP致命错误:找不到类'COM'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!