Page 1 of 1

fatal error regonising COM

Posted: Thu Mar 26, 2009 9:27 am
by bluebirdjc
There is a problem in line 7 which ive highlighted in blue with the php code

the error that comes up is
Fatal error: Class 'COM' not found in /nfs/mntI4/projectsite/J.K.Childs/wordtotxt.php on line 7

<?

$filename="APPENDIX A.doc";

$TXTfilename = $filename . ".txt";

$word = new COM("word.application") or die("not able to convert the word document");

$word->testing/->Open($APPENDIX A.doc);

// the '2' parameter specifies saving in txt format

$word->testing/[1]->SaveAs($TXTfilename ,2);

$word->testing/[1]->Close(false);

$word->Quit();

$word->Release();

$word = NULL;

unset($word);

$content = file_get_contents($TXTfilename);

unlink($TXTfilename);

?>

I got the code for this from the following website http://snipplr.com/view/8364/convert-wo ... text-file/

Re: fatal error regonising COM

Posted: Fri Mar 27, 2009 12:17 am
by sujithtomy
Hello,

Please check your php info whether your php configured with COM

i think you need php5
Requirements
COM functions are only available for the Windows version of PHP.

.Net support requires PHP 5 and the .Net runtime.

Installation
There is no installation needed to use these functions; they are part of the PHP core.

The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.

You are responsible for installing support for the various COM objects that you intend to use (such as MS Word); we don't and can't bundle all of those with PHP.