Conversion plugin phpxlsx
Common problems and possible errors
Tip
phpxlsx includes the check-conversionplugin.php script to automatically detect the most common issues during the conversion plugin setup, with suggestions of solutions for them.
Common problems and issues
- Font families: To generate PDFs with the same fonts as the original file you need those fonts installed in your operating systems. All operating systems allow to install them easily.
LibreOffice Linux common problems and issues
-
.config directory: LibreOffice needs permissions to read and write in the .config directory on the PHP HOME. You can obtain it with this line of code:
If this directory doesn't exist you have to create it with rwx permissions for the LibreOffice user or set 777 access.
If you get an empty value as home folder, you can change the PHP configuration to set a custom one, or set a value dynamically using phpxlsx. For example, to set /home/web as HOME folder:
- Error rename: If you get an error quite similar to rename(tmp/document.pdf,tmp/output.pdf) when you try the conversion and actually get the XLSX you wanted to create. That error is due to the impossibility of converting the spreadsheet through LibreOffice. See Debugging LibreOffice for more information.
- CentOS: If you work with CentOS and install the LibreOffice packages from the official repositories, it is mandatory to install the libreoffice-headless package to run the conversion plugin.
- SELinux: If you're working with SELinux you need to disable it or put the process type or SELinux into permissive mode by using setenforce or semanage commands.
-
Concurrent conversions: To transform multiple files at the same time and generate all outputs correctly, multiple folders must be used as home path. The best solution is using a random path of the home folder:
Or using extraOptions:
LibreOffice Windows common problems and issues
-
phpxlsx set up file: If the path to LibreOffice in the config/phpxlsxconfig.ini file contains spaces, you have to wrap it between single quotation marks, e.g.:
-
IIS web server: To convert files properly with this web server you have to grant rw access to the IIS user (IUSR and IIS_IUSRS as default) for the target directory, and then check the following set up PHP line:
-
Temp folder for the conversions: When using IIS web server, a temp folder must be set using the extraOptions option. For example, to use C:\Windows\Temp\LibreOffice as temp folder:
- Error rename: The rename PHP method may show an error quite similar to rename(tmp/document.pdf,tmp/output.pdf) when you try the conversion and actually get the XLSX you wanted to create. That error is due to the impossibility of converting the document through LibreOffice. See Debugging LibreOffice for more information.
- Concurrent conversions: Please check the same question in the LibreOffice Linux common problems and issues section.
MS Excel common problems and issues
- Error using the active document: if the transformation returns an error related to unable to open the XLSX, the msexcel method allows to choose documents or active as selected content. The default value is active, if it fails documents must be chosen.
- dcom config should be configured to allow "interactive user", "remote access" and "remote action", as well as adding the "IUSR" account.
- Source and target files must use absolute paths and double backslashes: 'C:\\folder\\file.xlsx' .