barryvdh / laravel-snappy

Laravel Snappy PDF
MIT License
2.59k stars 289 forks source link

Permissions: 126 error on Mac M1, Mac OS X 12.6.2,Laravel 9 #496

Open plweil opened 1 year ago

plweil commented 1 year ago

I realize that this is a wrapper, but perhaps someone could please confirm what permissions or what else to check? I can't tell whether the binary cannot execute, can't write to /var/tmp, or .... what else could cause this?

This is on an M1 MacBook, Mac OS X 12.6.2. The error I'm getting is:

RuntimeException
The exit status code '126' says something went wrong: stderr: "sh: /Users/plweil-sa/code/wisconsin-idea/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64: cannot execute binary file " stdout: "" command: /Users/plweil-sa/code/wisconsin-idea/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/var/tmp/knp_snappy63ca9de975d015.16357143.html' '/var/tmp/knp_snappy63ca9de975eb95.15706445.pdf'.

I've installed the binary (amd64)as per the docs. The Snappy config file:

  'pdf' => [
    'enabled' => true,
    'binary' => base_path(
      'vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
    ),
[...]

The binary permissions:

wisconsin-idea git:(statewide-report) ✗ cd vendor/h4cc/wkhtmltopdf-amd64/bin
bin git:(statewide-report) ✗ ls -al
total 77744
drwxrwxr-x  3 plweil-sa  staff        96 Jan 15  2018 .
drwxrwxr-x  7 plweil-sa  staff       224 Jan 15  2018 ..
-rwxrwxr-x  1 plweil-sa  staff  39804584 Jan 15  2018 wkhtmltopdf-amd64

Permissions for /var/tmp:

lrwxr-xr-x@ 1 root wheel 11 Dec 2 02:43 var -> private/var

/private/var: drwxr-xr-x 35 root wheel 1120 Jan 4 10:23 var

and

drwxrwxrwt 8 root wheel 256 Jan 20 07:46 tmp

RishabSwift commented 1 year ago

See #51 for solution

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.

gdevlugt

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy. If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.