There is an IIS 7 webserver and PHP 5.3

I have set com.allow_dcom = true on php.ini file and restarted the webserver.

I need to use hmailserver by:

$obBaseApp = new COM("hMailServer.Application");

It says:

Fatal error: Class 'COM' not found in C:\inetpub\wwwroot\test.php on line 22

  • Exact Version of PHP is 5.3.16 – Metalik Sep 1 '12 at 10:21

The php 5.4.5 build from windows.php.net ships the com/dotnet module as extension dll. If that's the case with your version of php too you can enable the module via


in your php.ini

Quotation from this link: https://stackoverflow.com/a/12002924/1274378

| improve this answer | |

If you are using windows 8 and Apache server and extension=php_com_dotnet.dll not worked for you then:

copy php_com_dotnet.dll file to c:/windows/system32 and write to php.ini file.

extension = c:/windows/system32/php_com_dotnet.dll

I'm using Windows 8 and Apache server for windows. Worked for me.

| improve this answer | |

to resolve this problem:

open your php.ini from php example : c:/xampp/php/php.ini

add extension=php_com_dotnet.dll to the extensions in php.ini file

if you are using this tool to control a microsoft office document make sure that microsoft office is installed in your windows server and don't forget that the COM tools works only on windows servers like microsoft windows server 2012

restart your server

run your code

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.