I setup COM support as specified in the PHP help files. I load my test page, but I get an unknown exception error, that doesn't help me at all? Winword.exe gets executed, but then php.exe quits and I have to force the process to close. Anyone know what I can do to fix this? I am using
Apache 2.0.47 and
PHP Version 5.0.0b2-dev.
Is there something special I need to setup in Apache? It seems as though I just needed to change php.ini and change some COM/DCOM options to get it to work?
PARTIAL CONTENTS OF PHP.INI:
[com]
;com.typelib_file =
com.allow_dcom = 1
com.autoregister_typelib = 1
com.autoregister_casesensitive = 0
com.autoregister_verbose = 1
DISPLAY IN BROWSER:
Fatal error: Uncaught exception 'exception' with message 'Unknown exception' in F:\Apache2\htdocs\mycomtest_02.php:3 Stack trace: #0 {main} thrown in F:\Apache2\htdocs\mycomtest_02.php on line 3
CONTENTS OF http://localhost/mycomtest_02.php:
<?php
// starting word
$word = new COM("Word.Application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;
?>