wkhtmltopdf not detected even though installed, tested and working 100% in shell

(6 posts) (2 voices)
  1. rpark, Member

    Hi,
    As the title says, I have installed wkhtmltopdf successfully using the RPM and a basic "rpm -i <file>.rpm" within my Centos 7.7 server's shell as root.

    I then tested the installation by making a .pdf of http://www.google.com, the result was exactly was expected.

    I read the entire installation documentation and I have followed all steps, including adding this to my /users/defaults.php file:

    $mydbr_defaults['export']['wkhtmltopdf']['command'] = '/usr/local/bin/wkhtmltopdf';

    My server's path to wkhtmltopdf is correct, it is installed at '/usr/local/bin/', however, MyDBR can not see it installed in Environment Settings.

    Please point out where I might have mis-configured this installation, again, it works fine via shell and I HAVE included the explicit path to wkhtmltopdf in defaults.php. Not much else I can do unfortunately...

    Update1: Here's the results of 'which wkhtmltopdf' and 'wkhtmltopdf -V':

    [root@vps ~]# which wkhtmltopdf /usr/local/bin/wkhtmltopdf [root@vps ~]# wkhtmltopdf -V wkhtmltopdf 0.12.5 (with patched qt)

    Update2: Here's the contents of my /user/defaults.php file:
    <?php // This is used to override values in defaults.php at main level. $mydbr_defaults['export']['wkhtmltopdf']['command'] = '/usr/local/bin/wkhtmltopdf';

    $mydbr_defaults['page_title'] = 'SurveySource'; //$mydbr_defaults['oem']['sidemenu_mode'] = 'frame'; $mydbr_defaults['oem']['sidemenu_mode'] = 'report';

    $mydbr_defaults['oem']['favicons']['icons'] = array( array('type' => 'image/png', 'rel' => 'apple-touch-icon', 'href' => '/user/images/apple-touch-icon.png', 'sizes' => '180x180'), array('type' => 'image/png', 'rel' => 'icon', 'href' => '/user/images/favicon-32x32.png', 'sizes' => '32x32'), array('type' => 'image/png', 'rel' => 'icon', 'href' => '/user/images/favicon-16x16.png', 'sizes' => '16x16'), array('type' => 'text/xml', 'rel' => 'manifest', 'href'=> '/user/images/site.webmanifest'), array('type' => 'image/svg+xml', 'rel' => 'mask-icon', 'href'=> '/user/images/safari-pinned-tab.svg', 'color'=> '#5bbad5'), );

    /* Debug flag to determine server cookie problems. Enabling this may expose your database login information so use with caution

    $mydbr_defaults['debug_cookie'] = true; */

    I'm still stumped :(

  2. myDBR Team, Key Master

    Hi,
    most probable cause for this in CentOS is that your SELinux security settings are preventing web server to run wkhtmltopdf. You can first check if the is the culprit, by temporarily disabling SELinux (turn it back on once you tested it).

    $ sudo setenforce 0

    If the SELinux is blocking the execution, use sealert to check the logs and follow the instructions how to fix the issue (audit2allow).

    sealert -a /var/log/audit/audit.log

    --
    myDBR Team

  3. rpark, Member

    SELinux does not appear to be the issue, I ran sestatus and SELinux is not enabled.

    I ensured SELinux was off (even though not enabled) by using the 'sudo setenforce 0', restarted the server (just being paranoid), ensured SELinux was off still and wkhtmltopdf is still not seen as installed unfortunately, but still works fine from command line root.

    Appreciate further help on this.

  4. myDBR Team, Key Master

    OK,
    the next thing to check is that if your setup has disabled functions. Try to access the troubleshoot script at:

    mydbr/tools/troubleshoot/wkhtmltopdf.php

    --
    myDBR Team

  5. rpark, Member

    Thanks for the response, this is the message I recieve when running that script:

    passthru function disabled in php.ini. Check the disable_functions-directive.

    I went into my domain's php-fpm .conf file and found this line:

    php_admin_value[disable_functions] = exec,passthru,shell_exec_system

    I removed 'passthru' from that line resulting in this:

    php_admin_value[disable_functions] = exec,shell_exec_system

    I went back to the test script and ran it again, I received this message now:

    string(26) "/usr/local/bin/wkhtmltopdf" wkhtmltopdf 0.12.5 (with patched qt) int(0)

    Thus, I must be getting close, but still no dice, says it is not enabled..

  6. rpark, Member

    SOLVED, I had to remove 'exec' and 'passthru' from this line and it is working...

    Now to remove the myDBR logo from the header of each pdf (oem version)...


Reply

You must log in to post.