laravel-snappy: The exit status code '126' says something went wrong
Hi barry, when I hit my end point I get this exception:
The exit status code '126' says something went wrong: stderr: "sh: /Users/xroot/dev_projects/meetings/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64: cannot execute binary file " stdout: "" command: /Users/xroot/dev_projects/meetings/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/var/folders/ml/gzjp_czs0l9gcvwl4t297gn80000gp/T/knp_snappy555e07f59eaa96.81797228.html' '/var/folders/ml/gzjp_czs0l9gcvwl4t297gn80000gp/T/knp_snappy555e07f59ebe31.72659281.pdf'.
My config file:
<?php
return array(
'pdf' => array(
'enabled' => true,
'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
'timeout' => false,
'options' => array(),
),
'image' => array(
'enabled' => true,
'binary' => base_path('/vendor/h4cc/wkhtmltoimage-amd64/bin/wkhtmltoimage-amd64'),
'timeout' => false,
'options' => array(),
),
);
My route end point:
Route::get('pdf',function(){
$pdf = PDF::loadView('meetings.print');
return $pdf->download('invoice.pdf');
});
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16
Also keep in mind that these are Debian Wheezy (7.8) binaries. If you are using Mac OS X or Windows, these binaries won’t work.
So what to do on a Mac OS X?
if you use macOS ,
first of all go to http://wkhtmltopdf.org/downloads.html , then download the proper package according to your os . after installing the package do the followings :
in the config/snappy.php file , write the name of the {bin file} which has been installed in /usr/local/bin , which in my case is wkhtmltopdf :
‘binary’ => ‘/usr/local/bin/{bin file}’
so :
‘binary’ => ‘/usr/local/bin/wkhtmltopdf’
http://stackoverflow.com/questions/5035601/error-running-wkhtmltopdf-error-while-loading-shared-libraries