从PHP执行libreoffice exec()

我已经使用apache在freebsd服务器上安装libreoffice,以便以编程方式转换文档(例如odt-> pdf).它从命令行工作!但是我的目标是能够从PHP这要求网络用户(www)可以运行libreoffice.但它不能.

当我自己的用户运行libreoffice时,我得到:

%libreoffice --headless -convert-to pdf Litteraturundervisningogit.doc
javaPathHelper: not found #This should not be a problem,says people on the net.
convert /usr/home/bundsgaard.net/www/jeppe/foredrag/Litteraturundervisningogit.doc ->
 /usr/home/bundsgaard.net/www/jeppe/foredrag/Litteraturundervisningogit.pdf using writer_pdf_Export
%

如果我尝试与root相同的命令,它不起作用.同样的问题也是来自PHP的www-user:

sp# libreoffice --headless -convert-to pdf Litteraturundervisningogit.doc
javaPathHelper: not found
sp#

问题是我没有从libreoffice获取任何信息,因此我不知道为什么libreoffice不想像其他用户一样运行.

我的问题是:如何通过PHP中的exec()提供www用户权限来运行libreoffice?

我在运行convert命令之前设法快速导出HOME = / tmp来解决这个问题,这使得libreoffice在某处可以工作,这是魔术.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...