Conversion plugin phpdocx

Debugging LibreOffice

Debugging LibreOffice

If you use LibreOffice as the transformation tool for the conversion plugin and the example of the library doesn't create the output file, follow these steps to find out the source of the error:

1. Execute the LibreOffice conversion from the command-line interface.

For example, in Linux, type this:

Replace /opt/libreoffice/program/soffice with the path to LibreOffice in your operating system, and replace document.docx for an existing document.

2. Execute the transformDocument example included through the CLI mode.

3. If the PDF file is generated through the CLI mode, but not with a web server like Apache, the error is due to a security or permission problem.

To call LibreOffice using Linux, the server:

  • Needs read and write permissions in the .config folder of the user's HOME directory.
  • Needs to delete the possible blockage of SELinux or the blockage of the execution settings of external programs.

So, for example, if the user of the web server is www-data, and the HOME directory of this user is the default /var/www, then you must provide the user www-data with read and write permissions in the directory /var/www/.config.

A custom HOME folder can be set when doing the transforming. For example, to set it to /home/web:

On common problems and possible errors page are detailed the most common issues when working with LibreOffice and how to solve them.

4. Check the server and system log files to detect other possible problems related to the configuration of any program or the lack of permissions.

Next - Debugging OpenOffice