Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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

share|improve this answer
    
thanks for the advice; unfortunately, the path isn't the issue (see additional clarification added to the question). –  N Rohler Feb 23 '13 at 16:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.