duanduo0520 2018-08-03 13:55
浏览 871
已采纳

PHP错误 - 无法创建COM对象,未注册类

Related questions:

Fatal Error: "Class not registered" creating COM object

Where can I find all of the COM objects that can be created in Powershell?

I'm currently migrating a PHP website from a server running Windows Server 2003 and PHP 5.2 to one running Windows Server 2012 R2 and PHP 5.6.35. One script is giving me a "Class Not Registered" error when creating a COM object:

$obj = new COM('DllName.ClassName') or die ("Unable to create COM object");

I've checked the above questions, and can confirm that:

  • The COM DLL is registered on the server (both by checking the registry and using PowerShell)
  • The installation of PHP is 32-bit (PHP_INT_SIZE is 4).

I think the next thing for me to look at is the "Advanced Settings" dialog mentioned in the answer to the first question above, but where do I find it? The actual server in use is Apache, installed as part of WAMP, but I think the problem is at a lower level.

  • 写回答

2条回答 默认 最新

  • dongwen6743 2018-08-04 06:45
    关注

    The fix was to use the registry hack described in the blog post linked from the first linked question. The full process is:

    1. Copy the ActiveX DLL to C:\Windows\SysWOW64 (not System32).
    2. Open a command prompt, and register the DLL: C:\Windows\SysWOW64>regsvr32 <DllName>
    3. Open the registry (type regedit at the command prompt), and search for the DLL name in HKEY_CLASSES_ROOT\WOW6432Node\CLSID. The DLL should be found in a key named HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{GUID} . Copy the GUID to the clipboard.
    4. Create a new String value named AppID in this key (not in any of its sub-keys). Set the AppID value to the GUID (including braces).
    5. Create a new key: HKEY_CLASSES_ROOT\WOW6432Node\AppID\{GUID} .
    6. In this new key, create a String value named DllSurrogate . Leave the value blank.

    The ActiveX object should now be creatable from PHP using the COM functions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图