Page 1 of 1

PHP COM Interop causes Apache access violation error

PostPosted: 06. October 2008 16:26
by Xethyr
I'm trying to run some example PHP code that uses COM:

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.

PostPosted: 06. October 2008 16:30
by glitzi85
Never worked with COM, but i had to program access to Excel via vb.net and there i got in troubles because vb didn't close Excel correctly, even when i used the correct code.

It's just a guess, but look into your Taskmanager whether Word is really closed or not.

glitzi