Permission denied with wkhtmltopdf Permission denied with wkhtmltopdf symfony symfony

Permission denied with wkhtmltopdf


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)


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