e-Learner
e-Learner

Reputation: 517

Fatal error: Class 'COM' not found PHP. Win7 - Apache - PHP

$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

Upvotes: 6

Views: 20006

Answers (2)

Mehran
Mehran

Reputation: 16861

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.

Upvotes: 1

Radu Bompa
Radu Bompa

Reputation: 1634

Add COM support in php.ini:

 [COM_DOT_NET]
     extension=php_com_dotnet.dll

Upvotes: 23

Related Questions