I setup COM support as specified in the PHP help files. I load my test page, but I get a parsing error, it seems as though the parser doesn't understand new COM()? 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?
CONTENTS OF PHP.INI:
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
com.allow_dcom = 1
; autoregister constants of a components typlib on com_load()
com.autoregister_typelib = 1
; register constants casesensitive
com.autoregister_casesensitive = 0
; show warnings on duplicate constat registrations
com.autoregister_verbose = 1
CONTENTS OF http://localhost/mycomtest_02.php:
Parse error: parse error, unexpected T_FUNCTION in F:\Apache2\htdocs\mycomtest_02.php on line 3
<?php
// starting word
$word = new COM("word.application") or die <function.die.html>("Unable to instanciate Word");
print <function.print.html> "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;
?>