我正尝试使用Libreoffice读取php代码中的一些Docx和Excel文件,如下所示
try {
$libreoffice = $_SESSION['PATH_OOFFICE'];
$command = '/usr/bin/libreoffice6.1 -env:UserInstallation=file:///var/www/aalyan/html/trunk/backend/tmp//soffice_profile_us --cat pdf/word.docx 2>&1';
//$command = 'ls 2>&1';
exec($command, $exec_output,$ret);
$output_text = implode(' ', $exec_output);
$is_readable = strpos($output_text,'Error: source file could not be loaded');
if ($is_readable === false) {
unlink($documentfullpath);
return true;
} else {
return false;
}
} catch (Exception $ex) {
return false;
}
如果我等待了5分钟以上,但没有惊喜,他就走了,并且没有退回
当我仅用ls
更改命令时,它就可以工作,并且如果我直接在shell中运行第一个命令,它就可以正常工作
任何人对此都有任何想法