Forum


Replies: 1   Views: 2690
How to configure the libre office plugin correctly?
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 Capitalplanning  · 31-10-2017 - 00:49

Hi there,

I am following the instructions that are listed here:

https://www.phpdocx.com/documentation/conversion-plugin/debugging-libreoffice

For step 4 I am not completely sure what I need to do to get the server to call libre office working correctly to convert my docx files into pdf files. 

If I do this:

chown www-data:www-data /var/www/

It works but research leads me to believe that this is a security risk and that www-data should never be the owner of /var/www/.

I can also get the pdf conversion to work by modifyiing the phpdocx class TransformDocAdvLibreOffice(line 127) like so :

 passthru('export HOME=/tmp && ' . $libreOfficePath . ' --invisible "macro:///Standard.Module1.SaveToPdfA1Toc(' . realpath($docSource) . ')" ' . $outputDebug);

Obviously I would prefer to not modify any of the phpdocx files. 

Can you please help me to understand step 4 so that I can set the server up correctly.

Posted by admin  · 31-10-2017 - 05:43

Hello,

You only need to set rw access to the .config folder of the home folder. For example if you are using /var/www as home folder, you need to set rw access to the user that runs the web server to /var/www/.config.

About your command, you don't need to change phpdocx, you can set a custom home folder using the putenv function. For example to set it to /tmp:

putenv("HOME=/tmp");

Regards.