Fixed "class 'com' Not Found" Issue

I am trying to set up hMailServer in Window 8.1 professional edition, so my Yii application can use localhost email server. But I was stuck in a problem while I tried to install "PHPWebAdmin". Error message as follows:

Fatal error: Class 'COM' not found in E:\Server\wwwroot\PHPWebAdmin\initialize.php on line 13

Then I found the issue caused by:

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

I did not do any changes, and all the code was working in Window 7 professional edition. That’s really weird.

Finally I figure out the issue: The php 5.4.5 up build from, which has com/dotnet module as extension dll. But it’s not come with xampp the php.ini.

So I have to add below into Dynamic Extensions in php.ini file:


if your version already has this line, you just make sure it’s not commented.

Then you need check if php_com_dotnet.dll is existed in c:\windows\system32, if not copy it from xampp\php\ext.

Once you completed these two steps, the issue “Class 'COM” not found" issue should be solved.

Hope it can help you if you have similar issue.