I\'m trying to use LibreOffice for converting a spreadsheet to another format, when I execute the command from the console it works fine but when I do it from PHP using exec
I solved this problem with the command below :
exec('libreoffice --headless --invisible --norestore --convert-to pdf --outdir /my/folder /my/file/calc.xls');
Just check rights, libreoffice uses user home folder, If you use default settings for Ubuntu then PHP runs oenter code heren www-data rights and it's home is /var/www/, but default this directory is owned by root.enter code here
In PHP - you can see rigths:
exec('whoami', $arr);
print_r($arr);
In console - You can see your HOME and give correct rights:
su wwww-data
echo $HOME
exit;
chown www-data:www-data /var/www -R