PHP组件对象模型“访问被拒绝” [英] PHP Component Object Model "Access is denied"
问题描述
我的开发环境是PHP 5.3,IIS 7.5和Window7 Home。我正在开发一个原型应用程序,它需要PHP函数imagewindowgrab()。这个函数需要调用Windows组件对象模型(COM)。
My development environment is PHP 5.3, IIS 7.5, and Window7 Home. I am developing a prototype application, which requires the PHP function imagewindowgrab(). This function requires calling the Windows Component Object Model (COM).
我的单行代码是:
$browser = new COM("InternetExplorer.Application") or die("Unable to instantiate IE");
产生以下错误:
Fatal error: Uncaught exception 'com_exception' with message
'Failed to create COM object `InternetExplorer.Application': Access is denied. '
in C:\inetpub\wwwroot\trial.php:8 Stack trace: #0 C:\inetpub\wwwroot\trial.php(8): com->com('InternetExplore...') #1 {main} thrown
in C:\inetpub\wwwroot\trial.php on line 8
搜索小时后,通过.NET论坛浏览,找到好的资源:
After searching for hours, trolling through .NET forums, and finding good resources:
- http://forums.asp.net/t/1680634.aspx/1
- http: //learn.iis.net/page.aspx/624/application-pool-identities/
- http://forums.asp.net/t/1680634.aspx/1
- http://learn.iis.net/page.aspx/624/application-pool-identities/
What finally worked for me was following the instructions outlined in the answer to this SO question:
Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."
并按照以下说明操作:
- 在命令行请输入
DCOMCNFG
- 点击控制台根>组件服务>计算机>我的电脑,然后选择属性
- 在 COM安全>访问权限选项卡上点击编辑默认 IIS_IUSRS )或服务
- 检查允许本地访问
- On the command line enter
DCOMCNFG
- Click right on Console Root > Component Service > Computers > My Computer and select Properties
- On the tab COM Security > Access Permissions click on Edit Default and add the user (e.g. IIS_IUSRS) or service
- Check allow local access
推荐答案
这个问题似乎没有回答,但回答有自我解释有问题。
我只是在这里: -
This question appears unanswered but answer have self explained in question . I am just putting here :-
试用代码:
$browser = new COM("InternetExplorer.Application") or die("Unable to instantiate IE");
生成错误:
Fatal error: Uncaught exception 'com_exception' with message
'Failed to create COM object `InternetExplorer.Application': Access is denied. '
in C:\inetpub\wwwroot\trial.php:8 Stack trace: #0 C:\inetpub\wwwroot\trial.php(8): com->com('InternetExplore...') #1 {main} thrown
in C:\inetpub\wwwroot\trial.php on line 8
有助于解决的步骤和资源:
好资源: -
http://forums.asp.net /t/1680634.aspx/1
http://learn.iis.net/page.aspx/624/application-pool-identities/
实际有助于解决的资源: -
Resources that actually help to solve :-
Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."
步骤: -
- 命令行输入DCOMCNFG
- 在控制台根目录>组件服务>计算机>我的电脑上单击右键,然后选择属性
- >访问权限单击编辑默认
添加用户(例如。 IIS_IUSRS)或服务 - 选中允许本地访问
- In the line of command put DCOMCNFG
- Click Right on Console Root > Component Service > Computers > My Computer, And Select Properties
- In the Tab COM Security > Access Permissions Click in Edit Default Add the User (Ex. IIS_IUSRS) or service
- Check Allow Local Access
注意:从PHP访问COM框架的权限问题。
这篇关于PHP组件对象模型“访问被拒绝”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!