简体   繁体   English

使用shell_exec从php脚本运行unoconv的问题

[英]Issue running unoconv from php script with shell_exec

I am unable to use unoconv to convert a .doc to PDF from php using exec. 我无法使用unoconv使用exec将.doc从php转换为PDF。 Here is what I am trying: 这是我正在尝试的:

$output = exec("unoconv /opt/bitnami/apache2/htdocs/=".$fileData['name']);
error_log(print_r($output, TRUE));

This command, when run in the console works perfectly, but when run through php, it gives the following in the error logs: 此命令在控制台中运行时效果很好,但是在通过php运行时,它在错误日志中提供了以下内容:

python: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by python)
python: /opt/bitnami/common/lib/libssl.so.1.0.0: no version information available (required by python)
Aborted
[Thu Mar 28 20:13:58.312843 2013] [:error] [pid 1481] [client ***] 

I don't think the first two lines are relevant, and I'm not sure how to get more information on why it aborted. 我不认为前两行是相关的,而且我不确定如何获得有关中止原因的更多信息。 I also have tried running it using this wrapper stored in /usr/local/bin/unoconv.sh 我也尝试使用存储在/usr/local/bin/unoconv.sh中的包装器运行它

#!/bin/bash

if [ -z "$1" ]; then
    echo "Must pass file";
    exit 10;
fi

/usr/bin/unoconv -f pdf $1.rtf

But that gives the error 但这给出了错误

python: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by python)
python: /opt/bitnami/common/lib/libssl.so.1.0.0: no version information available (required by python)
/usr/local/bin/unoconv.sh: line 8:  2886 Aborted                 /usr/bin/unoconv $1
[Thu Mar 28 20:17:05.331830 2013] [:error] [pid 1188] [client ***]

Any ideas on what else to try? 还有其他尝试的想法吗? Thanks for your help 谢谢你的帮助

I've done it with exec(); 我已经用exec()完成了;

$path_exe = "\"C:\Program Files (x86)\LibreOffice 4\program\python.exe\" c:\unoconv\unoconv -f png ";
exec('"C:\Program Files (x86)\LibreOffice 4\program\python.exe" c:\unoconv\unoconv -f pdf 'c:\'.$filename, $array_buffer, $code_error); 

You should specify the path to the python.exe, and the path to unoconv 您应该指定python.exe的路径以及unoconv的路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM