我的開發環境是PHP 5.3,IIS 7.5和Window7 Home。我正在開發一個原型應用程序,它需要PHP函數imagewindowgrab()。此功能需要調用Windows組件對象模型(COM)。PHP組件對象模型「訪問被拒絕」
我的一行代碼是這樣的:
$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論壇曳,並尋找良好的資源之後:
- http://forums.asp.net/t/1680634.aspx/1
- http://learn.iis.net/page.aspx/624/application-pool-identities/
什麼終於爲我工作了下面的答案概括的說明這太問題:
Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."
,並與貫徹這些指示如下:
- 在命令行輸入
DCOMCNFG
- 在控制檯上單擊右鍵根>組件服務>計算機>我的計算[R並選擇屬性
- 在標籤COM安全>訪問權限點擊編輯默認並添加該用戶(例如, IIS_IUSRS)或服務
- 檢查允許本地訪問
這似乎已採取了我的訪問權限問題,從PHP的COM框架照顧。
歡迎來到SO!你應該把你的解決方案作爲答案,然後接受它來使其更加清晰。 – drew010 2012-03-22 23:08:19