Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP COM to Word

Status
Not open for further replies.

scriggs

IS-IT--Management
Jun 1, 2004
286
GB
I am trying to use PHP to control Word via COM.

I keep getting the following error when I try to use the COM.

Code:
Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: Word could not fire the event. in c:\inetpub\[URL unfurl="true"]wwwroot\php\phpword1.php[/URL] on line 5

I have now simplified my code so that a simple test should work and am using

Code:
<?php
$word = new COM("word.application") or die("Unable to instantiate Word");
$output = "C:\\test.doc"; //enter an explicit path to test.doc 
$word->Documents->Open($output); 
$word->Quit(); 
$word->Release(); //free Word 
$word = null;
?>

When I first ran the code I got a permissions error and followed advice found on here to add IUSR to the DCOM permissions using DCOMCNFG.EXE.

Any clues on this error and where to go?
 
I just checked my Event Viewer on the machine and can see the error:

Code:
Event Type:	Error
Event Source:	DCOM
Event Category:	None
Event ID:	10016
Date:		07/09/05
Time:		09:42:24
User:		WAGS20\IUSR_WAGS20
Computer:	WAGS20
Description:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{000C101C-0000-0000-C000-000000000046}
 to the user WAGS20\IUSR_WAGS20 SID (S-1-5-21-327433659-2059728693-1831969033-1010).  This security permission can be modified using the Component Services administrative tool.

For more information, see Help and Support Center at [URL unfurl="true"]http://go.microsoft.com/fwlink/events.asp.[/URL]

So I think this is a permissions issue - I just don't know how to solve it!
 
Solved this one myself now - I added ISUR_WAGS20 to the process {00C101C, etc.

Then I also had to add WORKGROUP\NETWORK to the process {00C101C, etc.

Anyone know:

1. What process {00C101C, etc. is?
2. How I can add these permissions automatically for my whole network? Can it be done server based?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top