Replies: 5   Views: 5408
The system cannot find the file specified. (code: 2) in [path]\classes\
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 brianbriskey  · 09-04-2018 - 15:29

We have tried all the steps on this thread:

As you can see in the code we create a file just fine. It is the renaming and converting process that bombs out. I have changed the parameters, ran as a script and I am stuck. We added .dll references to the PHP setting per other posts. Restarted the server, no change. I get this error from my test page as well as the example pages that came with the solution. 

We are running PHP on Windows Server. Any help would be appreciated. 

Here is my source code: 

$docx = new CreateDocx();
// enable the compatibility mode to allow the library to warn us in case of using non-compatible content
// add a text to the document
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit';
$docx->addText($text, $paramsText);
// generate the new document
$filename = '/pandp/temp/simpleHTML.docx';
$newname = '/pandp/temp/simpleHTML.pdf';
//make sure new file was created 
if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
$newpdf = new TransformDocAdvLibreOffice();
$newpdf->transformDocument($filename, $newname, '../temp/', array( 'method' => 'script'));





Posted by admin  · 09-04-2018 - 18:50


Are you able to do the transformation using PHP CLI mode?

Please check that LibreOffice is closed and try the first and second steps explained on:

First test is running directly the main exec of LibreOffice and then with PHP CLI mode. Is the PDF generated?

Also please check the common issues page and the info about using it on Windows:


Posted by brianbriskey  · 09-04-2018 - 18:57

Thank you Admin. I have performed all these steps. 

Posted by admin  · 10-04-2018 - 07:10


Then, are you able to transform the documents through the PHP CLI mode and the web server?


Posted by uma_work  · 18-04-2018 - 17:18


I had the same error message on Wnindows7 with Libreoffice. 

I had incorrect configuration in my config/phpdocxconfig.ini

It is important to have the "single quote" for LibreOffice executable path. 

See :

; libreoffice or openoffice
method = "libreoffice"

; libreoffice installation path, absolute path -- wrap with single quotes
path = '"C:\Program Files (x86)\LibreOffice 5\program\soffice.exe"'