本文介绍了Libreoffice --headless拒绝转换,除非root用户,否则无法在PHP脚本中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行无头Ubuntu服务器12.

Running headless Ubuntu server 12.something.

root @ server:chown www-data /my/path/ -R

root@server: chown www-data /my/path/ -R

root @ server:chgrp www-data /my/path/ -R

root@server: chgrp www-data /my/path/ -R

root @ server:chmod 755 /my/path/ -R

root@server: chmod 755 /my/path/ -R

root @ server:libreoffice --headless --convert-to pdf:writer_pdf_Export /my/path/foo.ppt --outdir /my/path

root@server: libreoffice --headless --convert-to pdf:writer_pdf_Export /my/path/foo.ppt --outdir /my/path

convert /my/path/foo.ppt -> /my/path/foo.pdf

像魅力一样工作.

root @ server:sudo -i -u www-data

root@server: sudo -i -u www-data

$ libreoffice --headless --convert-to pdf:writer_pdf_Export /my/path/foo.ppt --outdir /my/path

convert /my/path/foo.ppt -> /my/path/foo.pdf
Error: Please reverify input parameters...

该死.

root @ server:sudo -i -u someotheruser

root@server: sudo -i -u someotheruser

$ libreoffice --headless --convert-to pdf:writer_pdf_Export /my/path/foo.ppt --outdir /my/path

convert /my/path/foo.ppt -> /my/path/foo.pdf
Error: Please reverify input parameters...

该死.

有人知道吗?试图对此进行研究只会让我更加困惑.这可能是错误或某些依赖项古怪吗?

Anyone have any idea? Trying to research this just confused me more. Is this probably a bug or some dependency quirk?

推荐答案

我终于找到了答案.添加:

I finally found an answer to this...Add:

export HOME=/tmp &&

从一开始,所以:

export HOME=/tmp && libreoffice --headless --convert-to pdf:writer_pdf_Export /my/path/foo.ppt --outdir /my/path

这在CentOS 6.5上对我有用,在PHP中也作为shell_exec().

That worked for me on CentOS 6.5, and as shell_exec() in PHP.

这篇关于Libreoffice --headless拒绝转换,除非root用户,否则无法在PHP脚本中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 05:36