user3076049
user3076049

Reputation:

KnpSnappyBundle - wkhtmltopdf.exe.bat: Permission denied

In dev environment (windows) using xampp my pdf files are generated successfully, but in prod (linux):

string(545) "The exit status code '126' says something went wrong:

stderr: "sh: /home/trainingexperience/beta.trainingexperience.org/app/../bin/wkhtmltopdf.exe.bat: Permission denied"

stdout: ""

command: /home/trainingexperience/beta.trainingexperience.org/app/../bin/wkhtmltopdf.exe.bat --lowquality --encoding 'utf-8' '/home/trainingexperience/beta.trainingexperience.org/app/cache/prod/snappy/knp_snappy5936b3644fdf62.71499624.html' '/home/trainingexperience/beta.trainingexperience.org/app/../web/uploads/company/payments/test_cXrfA4L99zsiKi6Cfl5a.pdf'."

My config:

knp_snappy:
    pdf:
        binary: %kernel.root_dir%/../bin/wkhtmltopdf.exe.bat
    temporary_folder: %kernel.cache_dir%/snappy

Could it be because of Linux? What is the problem?

UPDATE

I tried:

knp_snappy:
    pdf:
        binary: %kernel.root_dir%/../bin/wkhtmltopdf
    temporary_folder: %kernel.cache_dir%/snappy

I got:

No such file or directory

I think could be the problem (composer.json): "wemersonjanuario/wkhtmltopdf-windows": "0.12.2.3". Is there a version to that could work on windows and linux at the same time?

Upvotes: 0

Views: 755

Answers (1)

fxlacroix
fxlacroix

Reputation: 567

You should define a shell executable for your production environement and your developement environment.

for linux

binary:     /usr/local/bin/wkhtmltopdf

for windows

binary:     "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\\"

as you can see, You can't sh (execute) a .bat file on linux.

Upvotes: 0

Related Questions