current position:Home>The problem of php running libreoffice to convert word file to pdf?

The problem of php running libreoffice to convert word file to pdf?

2022-08-06 18:38:43segmentfault

Running libreoffice in the liunx control panel to execute word to pdf is successful!
But using php to execute the libreoffice statement will report a 504 error, please give me some pointers?

The code is as follows:

$status = 1;
$strss = "export HOME=/tmp/ && /usr/bin/libreoffice --headless --convert-to pdf:writer_pdf_Export /www/wwwroot/doctor-link/public/contract/report.docx --outdir /www/wwwroot/doctor-link/public/contract/";
exec($strss, $log, $status);
print_r($status);

Execution under liunx alone is successful:
export HOME=/tmp/ && /usr/bin/libreoffice --headless --convert-to pdf:writer_pdf_Export /www/wwwroot/doctor-link/public/contract/report.docx --outdir /www/wwwroot/doctor-link/public/contract/



Other Answer 1:

You said that using php to execute the error 504 is to execute the php script directly on linux, or to execute your php code in other ways;
After the error is reported, you can try to disassemble the command and locate the specific oneerror affected.

copyright notice
author[segmentfault],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/218/202208021526430369.html

Random recommended