J'utilise COM en PHP pour manipuler MS Word 2003 avec succès dans Windows Server 2003, mais le même code est cassé dans le serveur Windows 2008. J'ai changé l'utilisateur en administrateur mais la même erreur s'est produite.PHP COM a échoué sur Windows 2008 Server
Pour le code ci-dessous:
<?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();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("C:\\wamp\\www\\iword\\Useless test.doc");
//closing word
$word->Quit();
//free the object
$word = null;
?>
J'ai eu cette erreur:
Loaded Word, version 11.0 Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: Command failed' in C:\wamp\www\iword\index.php:14 Stack trace: #0 C:\wamp\www\iword\index.php(14): variant->SaveAs('C:\wamp\www\iwo...') #1 {main} thrown in C:\wamp\www\iword\index.php on line 14