Forum


Replies: 1   Views: 6328
Com object `word.application': server execution failed
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by irishadar  · 12-03-2017 - 09:48

Hi I am using vertion 6 of phpdocx under php7.1.

I am trying to convert docx to pdf using word 2013 application.

This is the code I'm using:

<?php

require_once '../classes/CreateDocx.inc';
$docx = new CreateDocx();

print "source file is: ".'C:\phpdocx\310863.docx <br>';
print "destenation  file is: ".'C:\phpdocx\Testiris33.pdf';
$docx->transformDocxUsingMSWord('C:\phpdocx\310863.docx', 'C:\phpdocx\Testiris33.pdf');

?>

I'm getting this Error code:

Fatal error: Uncaught com_exception: Failed to create COM object `word.application': Server execution failed in C:\phpdocx\classes\MSWordInterface.inc:51 Stack trace: #0 C:\phpdocx\classes\MSWordInterface.inc(51): com->com('word.applicatio...') #1 C:\phpdocx\classes\CreateDocx.inc(5312): MSWordInterface->transformFormat('C:\\phpdocx\\3108...', 'C:\\phpdocx\\Test...') #2 C:\phpdocx\code\sample_iris.php(8): CreateDocx->transformDocxUsingMSWord('C:\\phpdocx\\3108...', 'C:\\phpdocx\\Test...') #3 {main} thrown in C:\phpdocx\classes\MSWordInterface.inc on line 51

I'm getting the same Error when using cor php code :

<?php
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
print "Loaded Word, version {$word->Version}\n";

?>

I've made all change in DCOM and allow even "EVREYONE" user to have full control,unfortunately  it is not working .

I've tested both on windows 7 and 2008 server.

does anyone encounter this problem ? any answers?

Can I open a ticket about this ?

A prompt answer will be appreciated

 

iris hadar

iaa

 

 

 

 

 

Posted by admin  · 12-03-2017 - 12:42

Hello,

That error code is a generic error due to some missing permission or access. We recommend you to try the included example (please note we use '\\' and '\\\\' to set the path of the folders):

http://www.phpdocx.com/api-documentation/format-conversion/transform-docx-into-pdf-using-ms-word

and the most simple sample available for PHP COM on:

http://php.net/manual/en/class.com.php

using PHP CLI mode to find where the error comes from. And then run it using a web browser.

Also please check this information about solving that generic error:

http://www.phpbuilder.com/columns/venkatesan20030501.php3

https://bytes.com/topic/php/answers/843960-php-com-ms-word-application

http://www.figured-it-out.com/figured-out.php?sid=24

Regards.