tôi đã viết các chức năng sau đây trong phpunoconv công trình từ thiết bị đầu cuối sử dụng www-data nhưng không phải từ kịch bản php cũng như www-data
public static function convert($originFilePath, $outputDirPath, $toFormat)
{
$command = 'echo $PATH & UNO_PATH=/usr/lib/libreoffice unoconv --format %s --output %s %s';
$command = sprintf($command, $toFormat, $outputDirPath, $originFilePath);
exec($command, $output, $result_var);
return compact('output', 'result_var', 'outputDirPath', 'originFilePath', 'toFormat');
}
Nó không tạo ra bất kỳ thông báo lỗi, hoặc bất kỳ tập tin pdf là tốt.
Trong thiết bị đầu cuối, khi tôi chạy unoconv trực tiếp dưới dạng dữ liệu www, tôi không có vấn đề gì.
Đây là kết quả của tôi sau khi thực hiện:
2013-05-26 03:05:30 Error: Array
(
[output] => Array
(
[0] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
)
[result_var] => 1
[outputDirPath] => /var/virtual/storyzer.com/cake-json/ltequotationapp/webroot/outputfiles/Excel/2
[originFilePath] => /var/virtual/storyzer.com/cake-json/ltequotationapp/webroot/outputfiles/Excel/2/dsadas.xlsx
[toFormat] => pdf
)
Xin cho biết.
Mất hơn một tuần nhưng cuối cùng tôi đã tìm ra! :) Internet thật tuyệt vời! ~~ –