$myapp = new COM("word.application");
// returns a fatal error: "Class 'COM' not found in c:/www/comConnector.php"

shell_exec("whoami");
//returns "NT authority/system"

My system setup

  • Win7 Pro
  • Apache Server version: Apache/2.2.23 (Win32)
  • PHP

    PHP 5.3.16 (cli) (built: Aug 15 2012 20:06:57)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

share|improve this question

2 Answers

up vote 6 down vote accepted

Add COM support in php.ini:

 [COM_DOT_NET]
     extension=php_com_dotnet.dll
share|improve this answer
Nice, welcome to SO – Mukul Goel Oct 8 '12 at 11:57
Thanks, glad to help! – Radu Bompa Oct 8 '12 at 11:58
Thanks, Woks fine ! Ohh Radu Bompa... Radu Bompa :-) – e-Learner Oct 8 '12 at 12:06
I'm glad it works for you. Maybe you can mark the question as answered :) – Radu Bompa Oct 8 '12 at 12:23
@Disquamovible Please accept this answer , in case this answers your query. regards – Mukul Goel Oct 9 '12 at 4:26

Since you are using PHP 5.3.16, make sure that you are pointing to the global namespace:

$myapp = new \COM("word.application");

Even though your PHP file might be in global namespace already, but it's a good practice.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.