KnpSnappyBundle生成退出状态代码'2'

时间:2016-02-06 22:22:52

标签: symfony pdf

我正在尝试生成发票pdf,因此我使用KnpSnappyBundle而不是symfony2& twig从html生成pdf

在我的ubuntu上,一切正常,在生产环境中(FreeBSD,共享主机)我收到一个我不明白的错误。 我的配置

knp_snappy:
    pdf:
        enabled:    true
        binary:     "%kernel.root_dir%/../bin/wkhtmltopdf-i386"
        options:    
            lowquality: false
            encoding: UTF-8
    image:
        enabled:    false
        binary:     "%kernel.root_dir%/../bin/wkhtmltoimage-i386"
        options:    []
    temporary_folder: %kernel.cache_dir%/snappy

错误

[2016-02-07 01:07:05] snappy.DEBUG: Generate from HTML (<!DOCTYPE html> <html>     <head>         <meta charset="UTF-8" />         <title>MeVisa Invoice</ti) to file (/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf). [] []
[2016-02-07 01:07:05] request.CRITICAL: Uncaught PHP Exception RuntimeException: "The exit status code '2' says something went wrong: stderr: "/home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386: 1: Syntax error: "(" unexpected " stdout: "" command: /home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386 --encoding 'UTF-8' '/home/visallc/visallc.nichost.ru/app/cache/prod/snappy/knp_snappy56b66e89618f48.25746598.html' '/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf'." at /home/visallc/visallc.nichost.ru/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php line 336 {"exception":"[object] (RuntimeException(code: 0): The exit status code '2' says something went wrong:\nstderr: \"/home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386: 1: Syntax error: \"(\" unexpected\n\"\nstdout: \"\"\ncommand: /home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386 --encoding 'UTF-8' '/home/visallc/visallc.nichost.ru/app/cache/prod/snappy/knp_snappy56b66e89618f48.25746598.html' '/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf'. at /home/visallc/visallc.nichost.ru/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php:336)"} []

我已将html缩减为“Hello PDF”,我尝试了不同的软件包和不同的配置。但他们都是基于wkhtmltopdf。 这里有任何帮助,这点是从html生成PDF。 谢谢stackoverflowers

1 个答案:

答案 0 :(得分:0)

尝试根据您的平台下载最新版本来升级您的二进制文件。

http://wkhtmltopdf.org/downloads.html