Wkhtmltopdf binary path validation gets it wrong

Created on 20 February 2021, almost 4 years ago
Updated 9 April 2024, 8 months ago

Problem/Motivation

The configuration form tells me that "The wkhtmltopdf binary does not exist at /usr/local/bin/wkhtmltopdf", even though it definitely exists. If I comment out the validation, and enter the same path, PDF generation works fine.

It looks like file_exists($binary_location) returns FALSE, even though the file exists and is accessible to the web server.

Steps to reproduce

I installed this module on a shared hosting, that makes the wkhtmltopdf binary available on the server. I suspect this is caused by a combination of parent folder permissions and symlinks. I can't tell you exactly though, because I don't have the permissions to check out the exact set up.

Proposed resolution

I suggest placing a warning next to the binary path if it can not be detected, instead of using validation, and not allowing the form to save.
Something like "The wkhtmltopdf binaries could not be detected at {binary_location}. Please verify the path.".

🐛 Bug report
Status

Active

Version

2.2

Component

User interface

Created by

🇧🇪Belgium menno@menno-maakt.be

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇦Bosnia and Herzegovina ogursoy

    May be it is beacause of "Warning: file_exists(): open_basedir restriction in effect." just add path to the openbasedir safe list.

  • Also getting this in Drupal 7
    sh: 1: /usr/local/bin/wkhtmltopdf: not found

    Though:

    ME@me:~/drupal/drupal-7/site$ ls -l /usr/local/bin/wkhtmltopdf
    -rwxr-xr-x 1 root root 46725128 Jun 10  2020 /usr/local/bin/wkhtmltopdf
  • 🇨🇾Cyprus chrisk8r

    Anyone managed to find the solution to this already?

Production build 0.71.5 2024