LukeTowers / oc-snappypdf-plugin

SnappyPDF integration for OctoberCMS
MIT License
12 stars 8 forks source link

Binary is not executable #13

Closed damsfx closed 1 year ago

damsfx commented 1 year ago

The plugin reports issue saying :
Exception: The vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8 binary is not executable so the htmlToPDF library cannot be used. ...

https://github.com/LukeTowers/oc-snappypdf-plugin/blob/80e69f0bc9c2be6138e1917163dd4d89c51e5b09/Plugin.php#L135-L137

But If I test it with :

php artisan tinker

> is_executable('vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8');
= true

> file_exists('vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8');
= true

> (!is_executable('vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8') && file_exists('vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8'));
= false

Any idea what's can be wrong?

LukeTowers commented 1 year ago

Not a clue, that's very bizarre. My first guess would be that the path being passed to the checkPathExecutable somehow doesn't match the path that you're testing with in tinker exactly.

damsfx commented 1 year ago

However, I used the path reported by the exception to run my tests.
The exception is reported every minute, which saturates the event log very quickly.

After much testing and investigation, I finally change my .env binaries path variable from : SNAPPY_PDF_BINARY="vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8" to a full one : SNAPPY_PDF_BINARY="/home/mywebsite/public_html/vendor/hounddd/wkhtmltopdf-amd64-centos8/bin/wkhtmltopdf-amd64-centos8"

and the issue seems to be no more reported.
The strange thing was that PDF generation still worked properly.