Organizational Research By

Surprising Reserch Topic

class com not found using -'php,xampp'

class com not found  using -'php,xampp'

I've been trying to open a word document in my script, but I get receiving the same error.

 Fatal error: Class 'COM' not found in /Applications/XAMPP/xamppfiles/htdocs/**/**.php on line 3

My code:


$word = new COM("word.application") or die("Unable to instantiate Word");

$word->Visible = 1;

$temp = $word->Dialogs->Item(228); // returns wdDialogToolsWordCount dialog object
$temp->Execute();   //updates the word count
$numwords = $temp->Words(); //gets the words out of it

echo 'Word count = '.$numwords;



I've tried to change php.ini and remove the semicolons from COM section.

path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
com.typelib_file =
allow Distributed-COM calls
com.allow_dcom = true
autoregister constants of a components typlib on com_load()
com.autoregister_typelib = true
register constants casesensitive
com.autoregister_casesensitive = false
show warnings on duplicate constat registrations
com.autoregister_verbose = true

and still getting the same error.

I'm using a XAMMP on mac, and a linux based web hosting.

asked Sep 8, 2015 by rajesh
0 votes

Related Hot Questions

1 Answer

0 votes
answered Sep 8, 2015 by rajesh