简体   繁体   中英

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. 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:

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

#!/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();

$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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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