I'm currently uploading a DOC or DOCX file via DropzoneJS and then convert it to PDF in the server using LibreOffice PHP exec. If I typed it manually in the server then it will convert but if I run it via browser then it is not converting. I'm trying to run the soffice without a sudo but the command run via browser is not working. How can I convert it via browser run?
Manual Command in Terminal:
/opt/libreoffice5.2/program/soffice --convert-to pdf /var/www/html/my_system/public/msword.doc --outdir /var/www/html/my_system/storage/app/quotations
Command ls -liah results for folders:
my_system, storage, app, quotations = drwxrwxrwx apache apache
My sudo visudo results (pasted lines with no comments in order):
Defaults requiretty
Defaults !visiblepw
Defaults always_set_home
www-data ALL=NOPASSWD:ALL
robert ALL=NOPASSWD:ALL
apache ALL=NOPASSWD:ALL
PHP File:
$command = '/opt/libreoffice5.2/program/soffice --convert-to pdf /var/www/html/my_system/public/msword.doc --outdir /var/www/html/my_system/storage/app/quotations';
if (!$return) {
echo "PDF Created Successfully";
} else {
echo 'PDF not created. Command = ' . $command . '=' . $return;
}
Thanks.
$returnin your sample code, so I preume that's abbreviated. And wjat is the command exit code?