Php openSuSE上的wkhtmltopdf:无法连接到X服务器

Php openSuSE上的wkhtmltopdf:无法连接到X服务器,php,symfony,pdf-generation,twig,wkhtmltopdf,Php,Symfony,Pdf Generation,Twig,Wkhtmltopdf,我需要openSuSE上的wkhtmltopdf。我已经通过存储库安装了它。版本为0.12.1 要使用Symfony呈现HTML,我使用KnpSnappyBundle。通过呈现细枝模板,我收到以下错误消息: The exit status code '1' says something went wrong: stderr: "wkhtmltopdf: cannot connect to X server " stdout: "" command: /usr/bin/wkhtmltopdf --

我需要openSuSE上的wkhtmltopdf。我已经通过存储库安装了它。版本为0.12.1

要使用Symfony呈现HTML,我使用KnpSnappyBundle。通过呈现细枝模板,我收到以下错误消息:

The exit status code '1' says something went wrong:
stderr: "wkhtmltopdf: cannot connect to X server
"
stdout: ""
command: /usr/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy557ee05c6bf5f1.66652130.html' '/srv/www/project/web/pdf/document-1.pdf'.

有没有办法以这种方式运行wkhtmltopdf而不出错?谢谢

openSuSE的解决方案:

  • 安装xvfb run(在其他*nix系统上可能为“xvfb”)
  • 将捆绑包的配置部分(在app/config/config.yml中)的二进制选项从“wkhtmltopf”更改为xvfb run-a-s“-screen 0 640x480x16”wkhtmltopf
  • 检查文件夹权限

  • 对于德国用户:

    openSuSE的解决方案:

  • 安装xvfb run(在其他*nix系统上可能为“xvfb”)
  • 将捆绑包的配置部分(在app/config/config.yml中)的二进制选项从“wkhtmltopf”更改为xvfb run-a-s“-screen 0 640x480x16”wkhtmltopf
  • 检查文件夹权限
  • 对于德国用户: