I'm having issues using COM with PHP. When I load a PHP page using COM for the first time, it works, but when I reload it a second time, Apache errors out with an access violation error.
Here's some example code:
<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "Loaded Word, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//closing word
$word->Quit();
//free the object
$word = null;
?>
The script should open up Word, echo the version to the page, and close Word. It works correctly the first time, but after that, Apache randomly errors out.
I'm using the latest version of XAMPP Lite, which contains Apache 2.2.9 and PHP 5.2.6.