I have installed libreoffice headless on a freebsd-server with apache in order to convert documents programmatically (e.g. odt->pdf). It works from the command line! But my
I'll recomend put config path first you run exec() or shell_exec();
IE:
// Vars putenv('PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin'); putenv('HOME=' . $outputdir);
$outputdir = chmod 777 And the same forlder from libreoffice command "--outdir"