I’ve been looking at this issue ever since I changed to a new hosting company for my VPS in September 2020. At that point, every SC project I deployed (about 20 of them) had a broken PDF export function. I’ve hired server admins to help to no avail. Nothing I did would make wkhtmltopdf work.
Finally, I pieced together what was going on after a server admin explained something to me about permissions, the PHP-FPM service (which I use on all my SC deployments) and some functions like exec, shell, system and passthrough.
On my server, exec is disabled in PHP-FPM by default. Once I enabled it for the domain which hosted the SC deployed project, and changed the appropriate wkhtmltopdf.exec file permission to 0744 (adding execute to the user group) PDF export worked once again.
I don’t know if any of you who are running your own VPS on Centos 7.9 with PHP-FPM know this or have had this issue like I have, but if so, I hope this helps. I’m not a server admin; I know enough to manage the sites I host and that’s about it. This never occurred to me but I did think this issue, which has been a problem for almost 3 years, had something to do with permissions (partially correct). I had no idea that exec was disabled by default. Obviously, I should have known this.