Hi,
I'm trying to access Word using PHP with a view to creating merge documents in Word from data from a MySQL database. I'm new to PHP and am trying to get the following code to work as a starting point.
<?php
$objWord = new COM("Word.Application");
if (!$objWord)
{
echo 'Failed to create object';
exit;
}
$objWord->Visible = 0;
$objWord->Documents->Add();
$objWord->Selection->TypeText("Hello world!");
$objWord->Documents[1]->SaveAs("C:\helloworld.doc");
$objWord->Documents[1]->Close(false);
$objWord->Quit();
$objWord = null;
unset($objWord);
?>
All that seems to happen when I access it from a browser is that the winword.exe starts and runs for about 60 seconds then terminates. No document is created. I've tried different derivatives of this and have changed Visible to 1 but it makes no difference. I've also tried adding echo "Finished"; at the end to see if it comes up in the browser but it doesn't.
the com / d-com setting in php.ini is set to True.
Any suggestions greatly appreciated.
Thanks
Balboa