How to fix problems with LibreOffice/OpenOffice previews

Please note:

Older versions of ownCloud also supported the preview generation of other file types such as PDF, SVG or various office documents. Due to security concerns those providers have been disabled by default and are considered unsupported. While those providers are still available, we discourage enabling them, and they are not documented.

Problem:

Creating previews with LibreOffice/OpenOffice is not working as expected when configuring it following the directives in the documentation:

https://doc.owncloud.org/server/9.1/admin_manual/configuration_files/previews_configuration.html

Solution:

There are several steps to check:

  1. Previews currently are only supported on non-windows systems

  2. LibreOffice/OpenOffice needs to be installed
    Ubuntu/Debian -> apt-get install --no-install-recommends libreoffice-writer
    CentOS -> http://diegolamonica.info/how-to-make-libreoffice-headless-to-work-on-centos-6-3/

  3. The correct path to your libreoffice / openoffice binary needs to be configured (check the manual of your system how to find it)

  4. Make sure that the user running your webserver/PHP process is allowed to execute this binary

  5. The PHP functions shell_exec() and escapeshellarg() are needed for the preview generation so make sure that they are not blocked in your PHP configuration (Hint: disable_functions)

  6. Check that you have configured your PHP directive open_basedir correctly to allow the access to the path which was configured in 2.)

  7. Check that you have configured SELinux correctly to allow the access to the path which was configured in 2.)

  8. Finally check that you don’t have configured an empty “preview_office_cl_parameters” option in your config.php and remove it completely as it is not really needed in a default environment.

  9. If this is still not working check your logfiles as described in:

  10. With never oC versions you need to explicitly add the following provider to your config/config.php: