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.