The problem
It was hard to find a resolution to this problem so I started some experiments.
There are no problems running the unoconv from the console (to convert docx to pdf for example) but is hard when you try to run from PHP as a www-data user.
(process:350363): dconf-CRITICAL **: 10:28:43.201: unable to create directory ‘/var/www/.cache/dconf’: Permission denied. dconf will not work properly.
LibreOffice 6.4 – Fatal Error: The application cannot be started.
User installation could not be completed.
Error: Unable to connect or start own listener. Aborting.
The first row shows that can’t your current user can’t create a folder i the path /var/www/.
The solution
What a surprise! In Ubuntu Linux this is the home folder of the www-data user by default and by default, the permission is set to root:root. I suppose it’s for some security reason. The thing you can do is to create 2 folders, which are required from unoconv to work – .cache and .config (and set the required permissions).
sudo mkdir .cache sudo chown -R www-data:www-data .cache/ sudo chmod -R 744 .cache/ sudo mkdir .config sudo chown -R www-data:www-data .config/ sudo chmod -R 744 .config/
Et voila. Your unoconv cant write cache and config so should work
P.S. To check your www-data $HOME
sudo cat /etc/passwd | grep www-data www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
example command
$command = 'unoconv -f pdf ' . $path.$file; exec($command, $output);
Update: Unoconv is deprecated
read more on git: https://github.com/unoconv/unoconv
Please note that there is a rewrite of Unoconv called “Unoserver”: https://github.com/unoconv/unoserver/
Views: 893
Hi,
I was dealing with the same issue, but with tomcat. I don’t know if it can be useful in your case, but here is mine :
My webapp (written in Java) needs to launch a shell scrip using unoconv, and unoconv tried to creat .cache in the tomcat’s homedir.
I look for a solution, found your website (thank you very much), but i’m not pleased to give write access to my tomcat’s homedir from my webapp. So, i just changed the HOME var in my shell script before calling unoconv.
It solved my issue.
Hope it helps :)
Cheers,
Gaby.