Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cianekaj's avatar

Error: The exit status code '127'

Hi team, I am using Laravel on Linux 16.04. Installed wkhtmltopdf 0.12.6(wkhtmltox_0.12.6-1.xenial_amd64) using the dpkg -i path command. Wkhtmltopdf was installed successfully. I was able to download google page by running "wkhtmltopdf https://google.com google.pdf" wkhtmltopdf is available in the path: /usr/local/bin/wkhtmltopdf. the binary directory available in snappy.php is: 'binary' => '/usr/local/bin/wkhtmltopdf'. I checked all the documentations about this issue and tried to apply them but the error persisted. I don't understand what I have done wrong. the full error message is:

The exit status code '127' says something went wrong: stderr: "sh: 1: /usr/local/bin/wkhtmltopdf: not found " stdout: "" command: /usr/local/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy6054f619cffb91.87186759.html' '/tmp/knp_snappy6054f619d01767.82081958.pdf'.

my snappy.php is:

'pdf' => [ 'enabled' => true, 'binary' => '/usr/local/bin/wkhtmltopdf', 'timeout' => false, 'options' => [], 'env' => [], ],

'image' => [
    'enabled' => true,
    'binary'  => '/usr/local/bin/wkhtmltoimage',
    'timeout' => false,
    'options' => [],
    'env'     => [],
],

could you please help on this

0 likes
1 reply
cianekaj's avatar
cianekaj
OP
Best Answer
Level 1

Hi team, I was able to solve this issue by creating a folder "bin" under my project and added the wkhtmltopdf and wkhtmltoimage in it then modified my snappy.php like this:


    'pdf' => [
        'enabled' => true,
        'binary' => base_path('bin/wkhtmltopdf'),
        'timeout' => false,
        'options' => [],
        'env'     => [],
    ],

    'image' => [
        'enabled' => true,
        'binary' => base_path('bin/wkhtmltoimage'),
        'timeout' => false,
        'options' => [],
        'env'     => [],
    ],

Please or to participate in this conversation.