2009-11-11 4 views
1

PHP에서 COM을 사용하여 Windows Server 2003에서 MS Word 2003을 성공적으로 조작했지만 Windows 2008 서버에서 동일한 코드가 손상되었습니다. 사용자를 관리자로 변경했지만 여전히 동일한 오류가 발생했습니다. 아래의 코드를 Windows 2008 Server에서 PHP COM이 실패했습니다

:

<?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; 
?> 

나는이 오류가있어 : 나는 당신이 그 디렉토리에 쓸 수있는 권한 문제를 가지고 말을 추측에

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

답변

0

을, 나는 제안 VBA에서 동일한 코드를 시도하여 실패 가능성을 좁 힙니다.

1

아파치 서비스를 시작하려면 권한 네트워크가있는 1 개의 창 계정이 필요합니다. 간단한 당신은 테스트 명령을 통해 아파치를 시작해야합니다. 서비스를 통해 apache를 시작하지 마십시오.

관련 문제