我正在使用PHP和kindlegen程序创建mobi文件生成器。
我在路径/var/www/webook_disk/ - PHP脚本中有:- kindlegen文件
echo exec(./kindlegen /var/www/webook_disk/books_drafts/1234/book.opf -o 1234.mobi)/var/www/webook_disk/books_drafts/1234/中的图书文件当我运行PHP脚本时,我得到了以下日志:
Info(prcgen):I1002: Parsing files 0000002当我从控制台运行./kindlegen /var/www/webook_disk/books_drafts/1234/book.opf -o 1234.mobi时,我得到以下日志:
*************************************************************
Amazon kindlegen(Linux) V2.9 build 1028-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014
*************************************************************
Info(prcgen):I1047: Added metadata dc:Title "Przykładowa książka"
Info(prcgen):I1047: Added metadata dc:Creator "webook"
Info(prcgen):I1047: Added metadata dc:Publisher "webook"
Info(prcgen):I1002: Parsing files 0000002
Info(prcgen):I1016: Building enhanced PRC file
Info(prcgen):I1015: Building PRC file
Info(prcgen):I1006: Resolving hyperlinks
Warning(prcgen):W14001: Hyperlink not resolved: /2010/07/Wyprawa-zlodzieja-do-Mazeri.html
Warning(prcgen):W14002: Some hyperlinks could not be resolved.
Info(prcgen):I1008: Resolving start reading location
Warning(prcgen):W14016: Cover not specified
Info(pagemap):I8000: No Page map found in the book
Info(prcgen):I1045: Computing UNICODE ranges used in the book
Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E]
Info(prcgen):I1046: Found UNICODE range: Latin Extended-A [100..17F]
Info(prcgen):I1046: Found UNICODE range: Latin-1 Supplement [A0..FF]
Info(prcgen):I1046: Found UNICODE range: General Punctuation - Windows 1252 [2013..2014]
Info(prcgen):I1017: Building PRC file, record count: 0000025
Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 61.30%
Info(prcgen):I1040: The document identifier is: "PrzykKadowa_ksiBQka"
Info(prcgen):I1041: The file format version is V5
Info(prcgen):I1031: Saving PRC file
Info(prcgen):I1033: PRC built with WARNINGS!
Info(prcgen):I1007: Resolving mediaidlinks
Info(prcgen):I1011: Writing mediaidlinks
Info(prcgen):I1009: Resolving guide items
Info(prcgen):I1017: Building PRC file, record count: 0000027
Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 60.45%
Info(prcgen):I1041: The file format version is V8
Info(prcgen):I1032: PRC built successfully
Info(prcgen):I15000: Approximate Standard Mobi Deliverable file size : 0002209KB
Info(prcgen):I15001: Approximate KF8 Deliverable file size : 0002215KB
Info(prcgen):I1037: Mobi file built with WARNINGS!看起来PHP脚本没有完成kindlegen程序的执行,并且停止在Info(prcgen):I1002: Parsing files 0000002上
可能是什么原因?
**UPDATE 1 **当我将php命令从exec更改为shell_exec时,输出如下所示:我将命令更改为shell_exec,下面是日志:
*************************************************************
Amazon kindlegen(Linux) V2.9 build 1028-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014
*************************************************************
Info(prcgen):I1047: Added metadata dc:Title "Przykładowa książka"
Info(prcgen):I1047: Added metadata dc:Creator "webook"
Info(prcgen):I1047: Added metadata dc:Publisher "webook"
Info(prcgen):I1002: Parsing files 0000002所以我使用哪个命令并不重要。问题是它突然停止了。
今天我发现var/crash中报告了一个错误:但是日志很长,所以我把它放在gist:https://gist.github.com/blaszczakphoto/a32fd65384fcd8dd4f48751bfd78e699中。
发布于 2017-05-31 09:53:28
查看文档,exec的返回值如下:
命令结果的最后一行。如果您需要执行一个命令,并将命令中的所有数据直接传递回而不受任何干扰,请使用passthru()函数。
您可能需要使用exec或马斯鲁。
https://stackoverflow.com/questions/44281310
复制相似问题