Q: wkhtmltopdf call from PHP exec results in exit code 127 failure Using CentOS 6.3x64.
I'm trying to run wkhtmltopdf (from here) from a PHP script.  I can successfully call wkhtmltopdf-amd64 directly via SSH. But when calling it from PHP via exec, it always fails with exit code 127.  The path is correct, so that isn't the issue.  I can successfully use exec to call ls and id etc, so the problem seems to be specific to calling wkhtmltopdf-amd64.  
I would presume this somehow relates to permissions, but I'm not sure what steps to take.  I've tried apache:apache and other ownerships on the program and it has 755 permissions.
Thanks for any guidance!
Additional note:
Sorry for not clarifying further above -- I have confirmed the issue does not relate to the path to the program.  I'm using the full absolute path.  I've confirmed that the exact same command can be run from the SSH line without problem (regardless of the pwd).  I've also created a shell script:
#!/bin/sh
echo 'hello, world!'

I can call this script via exec and it works properly.  However, if I modify it to be
#!/bin/sh
echo 'hello, world!'
/full/path/to/wkhtmltopdf-amd64 'http://www.google.com/' /full/path/to/output.pdf

it then fails and returns the exit code 127.

A: Your shell seems to be unable to find the binary. Try calling it with its full path name (e.g. /usr/bin/ls instead of ls). For further information, see man bash

A: I had the same issue a while back. In my case I got 126 without the execution bit set and 127 with the bit set.
I later figured out it was related to some shared libraries missing on the system. Even if the binary is linked statically it seems to use some shared libraries from the system.
I don't really remember which libraries were causing the problem, but this gist: https://gist.github.com/nghuuphuoc/8282411 is a good starting point I think.
