Failed to create COM object 'X': Class not

2019-01-29 12:51发布

There already is a working WAMP instance in a Windows 7 in which the line

$x = new COM("X");

does instantiate a COM object.

I was trying to locate a bug, and decided to use a fresh new WAMP installation on the same Windows 7 system as the previous one.

In the new one, the same line produces:

Failed to create COM object 'X': Class not registered ( Error code: 0x80040154 )

Now, since the first WAMP comes with it's own installation application (along with its DLL which holds the COM class) I can't exactly figure out what I need to change in the new WAMP so the line above will instantiate the object.

  • My WAMP version is: 2.2 and
  • Apache version : 2.2.21
  • PHP version : 5.3.10

Any idea what I need to set up properly?

2条回答
smile是对你的礼貌
2楼-- · 2019-01-29 13:32

You need to register the DLL, using

regsvr32 yourdll.dll
查看更多
贼婆χ
3楼-- · 2019-01-29 13:35

Managed to solve the problem by changing the working directory (using chdir) to be the same as the php.exe just before $x = new COM("X");.

I think the DLL wasn't propery registered, or lacked something in itself.

查看更多
登录 后发表回答