PHP DCOM - Getting DCOM/COM to work with PHP in Windows XP - fixes Access Denied Error

Getting DCOM/COM to work with PHP in Windows XP

If you are getting an Access Denied error message similar to:

PHP Fatal error: Uncaught exception `com_exception` with message `Failed
to create COM object `word.application`: Access is denied. ` in
E:Inetpubwwwroottutorcom_word.php:4 Stack trace: #0
E:Inetpubwwwroottutorcom_word.php(4): com->com(`word.applicatio...`)
#1 {main} thrown in E:Inetpubwwwroottutorcom_word.php on line 4

Please note: This sample error message happens when trying to instantiate MS WORD on a system with improper permissions.

In Windows:
1. Start
2. Run
3. Type "dcomcnfg"
4 Press OK
5. Expand Component Services
6. Expand Computers
7. Right click on My Computer
8. Go to Default Properties Tab
9. Make sure Enable COM Internet Services on this computer and Enable Distributed COM on this computer are checked.
10. Set Default Authentication Level to Default
11. Set Default Impersonation Level
12. Click the COM Security tab
13. Under the Access Permissions area, click Edit Limits...
14. Make sure ANONYMOUS LOGIN has remote access allowed
15. Click Add...
16. Under the "Enter object names to select" textarea enter "Everyone"
17. Give Everyone Local Access and Remote Access
18. Press Okay
19. Click Edit Default under the Access Permissions Area
20. Make sure SELF and SYSTEM have remote access
21. Also click Add... and repeat steps 16 and 17
22. Press OK
23. Under Launch and Activation Permissions click Edit Limits...
24. Make sure the Administrator user has remote launch and remote activation checked.
25. If Everyone group does not exist follow steps 16 and 17
26. Under the Everyone group allow local launch, remote launch, local activation, and remote activation.
27. Press OK
28. Click Edit Default... under Launch and Activation Permissions
29. Make sure Administrator, INTERACTIVE, and SYSTEM have remote launch and remote activation allowed.
30. Follow steps 16 and 17 to create an Everyone group
31. In the Everyone group allow local launch, remote launch, local activation, and remote activation.

In PHP.ini
1. Open PHP.INI
2. search for com.allow.dcom
3. uncomment it and set it to true
4. Save and close PHP.ini

Reboot PC and try your PHP again.

If you are still having problems -
1. Start
2. Run
3. Type "dcomcnfg"
4 Press OK
5. Expand Component Services
6. Expand Computers
7. Expand My Computer
8. Click on DCOM Config
9. Navigate to the COM object you are trying to load.
10. Right click on it and select properties.
11. Go to Security tab
12. Make sure that Launch and Activation Permissions has Use Default checked.
13. Same goes for Access Permissions and Configuration permissions.

Note: I haven`t gone this route, but I believe you can choose Customize then click Edit... and follow similar steps as we did in first part of this article to configure DCOM/COM access for a particular object. The Everyone group was the key fix for me, hope this helps.

Keywords: COM/DCOM PHP, COM PHP, DCOM PHP, Access Denied COM, COM Access Denied, XP COM/DCOM PHP


Submit a Comment






Comments

Ahmad

Posted on: Feb 6, 2012 9:05 pm

Many thanks man. H hope you always find help when ever you need it.

hugo

Posted on: Sep 26, 2011 3:27 am

Thanks. It worked for me. After 2 days trying to find a solution, only your tips solved my problem.

pekerscript

Posted on: Mar 14, 2011 6:02 am

works! thankyou! but now.. how can i do to make it work with .docx files'

Broken Arrow

Posted on: Feb 24, 2011 11:10 am

Confirming: This works and allows hMail Server Web Managament to work properly.

Mark

Posted on: Aug 18, 2010 8:57 am

Thanks for this! To confirm this also works for Office 2003 on Win 2008 R2

M

Posted on: Mar 4, 2010 1:19 am

Thank you!! d solution realy works...

Annie0630

Posted on: Dec 23, 2009 8:36 pm

You solve my problem. Thank you! :)

Alexandre

Posted on: Apr 2, 2009 10:22 am

After I complete this steps another error occurr...

"Fatal error: Call to a member function TypeText() on a non-object in D:...."

Phil

Posted on: Jan 4, 2009 10:34 am

When you say everything, do you mean when you try to launch an application or do you mean your denied from actual folders/files?

If you are being denied from opening applications, check your "Everyone" group and make sure they have Remote and Local access.

This solution worked fine for me running Windows XP Pro SP2.

Lastly, I would re-trace your steps using the steps 1-31 and make sure you did not miss anything.

hurs

Posted on: Jan 3, 2009 11:31 pm

i did this,
and now i cannot connect my machine!
everything says access is denied!

what can I DO ????

Orbic1

Posted on: Aug 15, 2008 3:40 am

Brilliant! Thank you! : )