PHP Component Object Model “Access is denied”

天大地大妈咪最大 提交于 2019-12-05 16:30:16

问题


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).

My single line of code was this:


$browser = new COM("InternetExplorer.Application") or die("Unable to instantiate IE");

It produced the following error:


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

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/

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."

AND following up those instructions with the following:

  1. On the command line enter DCOMCNFG
  2. Click right on Console Root > Component Service > Computers > My Computer and select Properties
  3. On the tab COM Security > Access Permissions click on Edit Default and add the user (e.g. IIS_IUSRS) or service
  4. Check allow local access

This appears to have taken care of my Access Permission problems with the COM framework from PHP.


回答1:


This question appears unanswered but answer have self explained in question . I am just putting here :-

Tried Code :-

$browser = new COM("InternetExplorer.Application") or die("Unable to instantiate IE");

Error Generated :-

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

Steps and resources that helped to solved :-

Good Resources:-

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."

Steps :-

  1. In the line of command put DCOMCNFG
  2. Click Right on Console Root > Component Service > Computers > My Computer, And Select Properties
  3. In the Tab COM Security > Access Permissions Click in Edit Default Add the User (Ex. IIS_IUSRS) or service
  4. Check Allow Local Access

Note : Take care of Access Permission problems with the COM framework from PHP.



来源:https://stackoverflow.com/questions/9561504/php-component-object-model-access-is-denied

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!