fatal error regonising COM

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bluebirdjc
Forum Newbie
Posts: 3
Joined: Tue Jan 27, 2009 10:53 am

fatal error regonising COM

Post 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/
sujithtomy
Forum Commoner
Posts: 46
Joined: Tue Mar 24, 2009 4:43 am

Re: fatal error regonising COM

Post 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.
Post Reply