- Code: Select all
<?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;
?>
It works fine the first time, but when I run it a second time, the page doesn't load, and I get an Apache error. When I debug it, it says Apache got an access violation error. Any suggestions?
I'm using XAMPP Lite 1.6.8.