简体   繁体   English

如何授予PHP对COM对象的访问权限?

[英]How can I give PHP access to a COM object?

I am running PHP 5.3 on my local Windows 7 Laptop (have tried this all on our development server with no success, so I tried to see if I could get it to work on my laptop successfully first). 我正在本地Windows 7笔记本电脑上运行PHP 5.3(已在开发服务器上尝试了全部操作,但未成功,因此我尝试查看是否可以首先使其在笔记本电脑上成功运行)。 When I call the following script: 当我调用以下脚本时:

$objAltovaXML = new COM('AltovaXML.Application');

I get the error: 我得到错误:

Uncaught exception 'com_exception' with message 'Failed to create COM object `AltovaXML.Application': Access is denied. 消息为“无法创建COM对象'AltovaXML.Application'的未捕获异常'com_exception':访问被拒绝。

I have checked using a PowerShell script I have found elsewhere on StackOverflow and have confirmed tht AltovaXML.Application is properly registered. 我已经使用在StackOverflow上其他地方找到的PowerShell脚本进行了检查,并确认AltovaXML.Application已正确注册。

But how do I give my PHP script access to it? 但是,如何授予我的PHP脚本访问权限?

While it should work I would just wrap a script around COM object and invoke that script via exec . 虽然它应该工作,但我只是将脚本包装在COM对象周围,然后通过exec调用该脚本。 Saves you a lot of trouble and is easy to debug separately and understand what exactly is going on. 为您节省了很多麻烦,并且易于分别调试和了解实际情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM