簡體   English   中英

使用shell_exec()執行libreoffice命令時出錯

[英]Error on executing libreoffice command using shell_exec()

碼:

shell_exec('libreoffice --convert-to pdf `'.$my_file.'` --headless');

我也嘗試過

shell_exec('libreoffice --convert-to pdf `'.$my_file'` --headless > /dev/null');

執行以上操作時服務器上的錯誤:

輸出:sh:/my_files/my_file.doc:無法執行二進制文件

注意: linux的所有其他命令都可以與shell_exec()一起正常工作,只是libreoffice命令不起作用。 在Linux終端上, libreoffice命令可以正常工作,只是不能在PHP工作。

您正在使用反引號,它告訴子Shell運行該命令並在其位置使用其輸出。 而是使用雙引號,它將更頻繁地工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM