hkhtmltopdf Export Fails with code:139

(2 posts) (2 voices)
  1. sdysart, Member

    The server where everything is hosted was recently migrated and upgraded to PHP 7. We had no issue previously.
    I have:
    Ubuntu 18.04
    myDBR 5.2.3 (build 3718)
    MySQL 5.7.24

    I have hkhtmltopdf installed (it was initially missing from the new server) and can generate a PDF from the Linux command line by calling hkhtmltopdf and pointing to a webpage.
    The MyDBR Environment Variables pages shows wkhtmltopdf (0.12.5 (with patched qt)) under installed modules.
    hkhtmltopdf is located in /usr/local/bin and I have edited the defaults.php file in the mydbr/user directory to point to it using $mydbr_defaults['export']['wkhtmltopdf']['command'] ='/usr/local/bin/wkhtmltopdf';
    When attempting to export, I get "There was an error (code:139) producing the pdf document".

    Following the direction on another post, I checked server side files in MyDBR but did not see the file export_header_pdf.php listed, or any other php files. However, I can see that the file is present in the /var/www/mydbr folder from the command line. When I add "select 'dbr.export.options', 'debug', 1;" to the report and execute the command I get back from the report on the Linux command line, I get back the following: Exit with code 1 due to network error: HostNotFoundError

    I will admit that Linux is not my normal environment, so I could be missing something obvious. Any help is appreciated.

  2. myDBR Team, Key Master

    Following the direction on another post, I checked server side files in MyDBR but did not see the file export_header_pdf.php listed, or any other php files

    What do you mean by this? What did you not see listed and where?

    Exit with code 1 due to network error: HostNotFoundError

    This sounds like the server does not know it's own name. When the wkhtmltopdf-command is run, it includes the header section with reference to the hostname. If the server does not find itself, the command fails.

    Try running 'ping your_hostname' from Ubuntu (where your_hostname is the name shown as host in your wkhtmltopdf-command). If the ping returns 'Unknown host', add the hostname to /etc/hosts:

    127.0.0.1 your_hostname

    --
    myDBR Team


Reply

You must log in to post.