我已经在shell_exe()
函数中运行了这个命令,如下所示:
shell_exec('/usr/bin/soffice --headless --convert-to html:HTML --outdir /home/admin/Desktop/ /home/admin/Desktop/text.docx');
但它在 apache 错误日志中给了我这样的错误:
错误:请重新验证输入参数...
您收到的错误与 PHP / apache 无关。
这是一个soffice
输出。
因此shell_exec()
,即使执行的命令返回了一个传递回函数的输出,也可以毫无问题地shell_exec()
工作。
如何运行soffice
我推荐搜索论坛,例如:https ://ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/
接收错误输出最好使用exec()
函数而不是shell_exec()
https://unix.stackexchange.com/questions/15264/executing-a-shell-command-from-php-with-shell-exec