2017-05-31 5 views
0

PHPとkindlegenプログラムを使用してmobiファイルジェネレータを作成しています。PHPからの外部プログラム(kindlegen)の実行がエラーなしで終了しない

私が持っている

: - 私はPHPスクリプトを実行すると、私はこのログを取得/var/www/webook_disk/books_drafts/1234/

にPHPスクリプト

echo exec(./kindlegen /var/www/webook_disk/books_drafts/1234/book.opf -o 1234.mobi) 
  • ブックファイル - パスに/var/www/webook_disk/ の中にファイルkindlegen:

    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 ** 私はexecからの出力は、そのようなものですshell_execにPHPのコマンドを変更する場合: 私は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で報告されたエラーがあったことを発見: しかし、ログが非常に長いので、私は要旨にそれを置く: https://gist.github.com/blaszczakphoto/a32fd65384fcd8dd4f48751bfd78e699

答えて

0

Looking at the documentationexecの戻り値は以下の通りです:

コマンドの結果の最後の行。 コマンドを実行し、コマンドのすべてのデータを干渉なしで直接返すようにするには、passthru()関数を使用します。

shell_execまたはpassthruを使用します。

+0

私はあなたのソリューションを試して、メインの質問に更新を貼り付けました。 – mario199

関連する問題