Permission denied with wkhtmltopdf

拜拜、爱过 提交于 2019-12-10 10:12:38

问题


I have installed Wkhtmltopdf and I have this error when I execute him "/var/chroot/wkhtmltox-jessie-amd64: Permission denied". I search in Google but I have not found how to do ... repertory have this permission "drwxr-xr-x root root" and i execute him in web-server (apache) and Symfony.

Error :

The exit status code '126' says something went wrong: stderr: "sh: 1: /var/chroot/wkhtmltox-jessie-amd64: Permission denied " stdout: ""

Can you help me ?


回答1:


I encountered the same problem on the server; it was weird that the local version was happily doing its job. After changing the generated file's destination folder permissions without any luck, I realised that the problem whas caused by the binary path in config.yml. I changed it from:

/opt/wkhtmltox/bin/wkhtmltopdf.exe

to:

/opt/wkhtmltox/bin/wkhtmltopdf

Now all it's ok.

PS: if you don't keep wkhtmltopdf in the vendor's file (my case), create a knp_snappy config in config_prod.yml; the paths are different from local to prod version.

Here is the official documenation of KnpLabs Bundle for more info.

Good luck ! (in case you needed any 'after 1 year and 11 months' answear)




回答2:


Install library Wkhtmltopdf on custom folder in the user directory for linux or mac save this route and set in your config

This solution working in production server

This error is because var and opt folder you can't write any content if not root user



来源:https://stackoverflow.com/questions/36065028/permission-denied-with-wkhtmltopdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!