php system调用libreoffice转换文件 retu

2017-11-01  本文已影响0人  muti_wu

操作系统:centos6.7 64位

执行命令:system("libreoffice --invisible --convert-to pdf --outdir /phpstudy/www/Uploads/activity/2017-02-28/ /phpstudy/www/Uploads/activity/2017-02-28/58b53f9cad22e.xls",$retcode);

输出$retcode = 77

修改命令为:system("libreoffice --invisible --convert-to pdf --outdir /phpstudy/www/Uploads/activity/2017-02-28/ /phpstudy/www/Uploads/activity/2017-02-28/58b53f9cad22e.xls 2>&1");

输出信息:[Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx Warning: failed to read path from javaldx

修改代码为:system("export HOME=/tmp/ && libreoffice --invisible --convert-to pdf --outdir /phpstudy/www/Uploads/activity/2017-02-28/ /phpstudy/www/Uploads/activity/2017-02-28/58b53f9cad22e.xls 2>&1");

返回信息:convert /phpstudy/www/Uploads/activity/2017-02-28/58b53f9cad22e.xls -> /phpstudy/www/Uploads/activity/2017-02-28//58b53f9cad22e.pdf using calc_pdf_Export convert /phpstudy/www/Uploads/activity/2017-02-28/58b53f9cad22e.xls -> /phpstudy/www/Uploads/activity/2017-02-28//58b53f9cad22e.pdf using calc_pdf_Export

执行成功。

参考文献:https://stackoverflow.com/questions/22973641/php-libreoffice-shell-exec-not-working

上一篇下一篇

猜你喜欢

热点阅读