Blank Page when Using PDF template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pmontanez
    Member
    • Dec 2016
    • 81

    Blank Page when Using PDF template

    Good Day,

    I'm having problems after upgrade to 5.8.2 to print PDF templates, basically I'm getting a blank page- Now, I'm looking into the log files and it seems like is a folder permission related - it seems like the tmp folder is created outside the directory where Espo is installed.

    Code:
    [2020-02-18 16:27:53] Espo.WARNING: E_WARNING: is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): [B](/public_html:/home/nyinsurance/tmp[/B]) {"code":2,"message":"is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/nyinsurance/web/nyinsurance.us/public_html:/home/nyinsurance/tmp)","file":"/home/nyinsurance/web/nyinsurance.us/public_html/crm/vendor/zordius/lightncandy/src/LightnCandy.php","line":151,"context":{"php":"<?php use \\LightnCandy\\Runtime as LR;return function ($in = null, $options = null) {\n    $helpers = array();\n    $partials = array();\n    $cx = array(\n        'flags' => array(\n            'jstrue' => true,\n            'jsobj' => true,\n            'jslen' => true,\n            'spvar' => true,\n            'prop' => false,\n            'method' => false,\n            'lambda' => false,\n            'mustlok' => false,\n            'mustlam' => false,\n            'mustsec' => false,\n            'echo' => false,\n            'partnc' => false,\n            'knohlp' => false,\n            'debug' => isset($options['debug']) ? $options['debug'] : 1,\n        ),\n        'constants' => array(),\n        'helpers' => isset($options['helpers']) ? array_merge($helpers, $options['helpers']) : $helpers,\n        'partials' => isset($options['partials']) ? array_merge($partials, $options['partials']) : $partials,\n        'scopes' => array(),\n        'sp_vars' => isset($options['data']) ? array_merge(array('root' => $in), $options['data']) : array('root' => $in),\n        'blparam' => array(),\n        'partialid' => 0,\n        'runtime' => '\\LightnCandy\\Runtime',\n    );\n    \n    $inary=is_array($in);\n    return '<div style=\"text-align: center; \"><span style=\"font-size: 10px; background-color: rgb(239, 239, 239);\"><b>Questions&nbsp;About this Quote? &nbsp;Email us at support@nyinsurance.us</b></span></div>';\n}; ?>","tmpDir":"/tmp","delete":true}} []
    [2020-02-18 16:27:53] Espo.WARNING: E_WARNING: include(): data:// wrapper is disabled in the server configuration by allow_url_include=0 {"code":2,"message":"include(): data:// wrapper is disabled in the server configuration by allow_url_include=0","file":"/home/nyinsurance/web/nyinsurance.us/public_html/crm/vendor/zordius/lightncandy/src/LightnCandy.php","line":171,"context":{"php":"<?php use \\LightnCandy\\Runtime as LR;return function ($in = null, $options = null) {\n    $helpers = array();\n    $partials = array();\n    $cx = array(\n        'flags' => array(\n            'jstrue' => true,\n            'jsobj' => true,\n            'jslen' => true,\n            'spvar' => true,\n            'prop' => false,\n            'method' => false,\n            'lambda' => false,\n            'mustlok' => false,\n            'mustlam' => false,\n            'mustsec' => false,\n            'echo' => false,\n            'partnc' => false,\n            'knohlp' => false,\n            'debug' => isset($options['debug']) ? $options['debug'] : 1,\n        ),\n        'constants' => array(),\n        'helpers' => isset($options['helpers']) ? array_merge($helpers, $options['helpers']) : $helpers,\n        'partials' => isset($options['partials']) ? array_merge($partials, $options['partials']) : $partials,\n        'scopes' => array(),\n        'sp_vars' => isset($options['data']) ? array_merge(array('root' => $in), $options['data']) : array('root' => $in),\n        'blparam' => array(),\n        'partialid' => 0,\n        'runtime' => '\\LightnCandy\\Runtime',\n    );\n    \n    $inary=is_array($in);\n    return '<div style=\"text-align: center; \"><span style=\"font-size: 10px; background-color: rgb(239, 239, 239);\"><b>Questions&nbsp;About this Quote? &nbsp;Email us at support@nyinsurance.us</b></span></div>';\n}; ?>","tmpDir":"/tmp","delete":true}} []
    [2020-02-18 16:27:53] Espo.ERROR: Uncaught Exception Error: "Function name must be a string" at /home/nyinsurance/web/nyinsurance.us/public_html/crm/application/Espo/Core/Htmlizer/Htmlizer.php line 575 {"exception":"[object] (Error(code: 0): Function name must be a string at /home/nyinsurance/web/nyinsurance.us/public_html/crm/application/Espo/Core/Htmlizer/Htmlizer.php:575)"} []
    Any Help its appreciated -- Thanks
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    please open your pdf template code view and investigate it. I am sure a code syntax is broken.

    Comment

    • pmontanez
      Member
      • Dec 2016
      • 81

      #3
      Thanks for your message Maximus but i just create a new pdf Template from scratch using very basic info and I'm having the same issue - Now I think that location of the temp file that is crated in the process is out of the installation folder and perhaps is the the reason of the failure - This is the log info after I try to create a Quote from a Template.
      Code:
      2020-02-19 14:59:33] Espo.WARNING: E_WARNING: is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/nyinsurance/web/nyinsurance.us/public_html:/home/ny$ome/nyinsurance/tmp) {"code":2,"message":"is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/nyinsurance/web/nyinsurance.us/public_html:/home/nyins$/nyinsurance/tmp)","file":"/home/nyinsurance/web/nyinsurance.us/public_html/crm/vendor/zordius/lightncandy/src/LightnCandy.php","line":151,"context":{"php":"<?php use \\LightnCandy\\SafeString as$ing as SafeString;use \\LightnCandy\\Runtime as LR;return function ($in = null, $options = null) {\n    $helpers = array();\n    $partials = array();\n    $cx = array(\n        'flags' => array(\$rray(\n            'jstrue' => true,\n            'jsobj' => true,\n            'jslen' => true,\n            'spvar' => true,\n            'prop' => false,\n            'method' => false,\n     $n            'lambda' => false,\n            'mustlok' => false,\n            'mustlam' => false,\n            'mustsec' => false,\n            'echo' => false,\n            'partnc' => false,\n $$se,\n            'knohlp' => false,\n            'debug' => isset($options['debug']) ? $options['debug'] : 1,\n        ),\n        'constants' => array(),\n        'helpers' => isset($options['he$$ns['helpers']) ? array_merge($helpers, $options['helpers']) : $helpers,\n        'partials' => isset($options['partials']) ? array_merge($partials, $options['partials']) : $partials,\n        'sc$   'scopes' => array(),\n        'sp_vars' => isset($options['data']) ? array_merge(array('root' => $in), $options['data']) : array('root' => $in),\n        'blparam' => array(),\n        'partia$$partialid' => 0,\n        'runtime' => '\\LightnCandy\\Runtime',\n    );\n    \n    $inary=is_array($in);\n    return '<img src=\"?entryPoint=attachment&amp;id=59405f338d6cc6e6e\" style=\"width: $$idth: 258.541px; float: left; height: 67px;\"><h1 style=\"text-align: center; \"><span style=\"color: inherit;\"><br>Insurance Invoice</span></h1>\n<table class=\"table table-bordered\" style=\"f$$le=\"font-size:12px;\">\n<tbody>\n<tr>\n<td width=\"50%\"><b>Applicant Name and Mailing Address</b><br><br><b>\n'.LR::encq($cx, (($inary && isset($in['accountName'])) ? $in['accountName'] : null)$$ull)).'</span><br></td></tr></tbody></table>';\n}; ?>","tmpDir":"/tmp","delete":true}}

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Ok, this issue is related to a bad pass to /tmp directory in webserver's PHP configs. Open php.ini file (e.g. if you are using Apache it may be located in /etc/php/7.3/apache2) and find this line sys_temp_dir. In my case it is represented as sys_temp_dir = "/tmp". After fixing this you should restart or reload your webserver to reload its configs.

        Comment

        • pmontanez
          Member
          • Dec 2016
          • 81

          #5
          Hey Maximus, thanks for the suggestion but I have the same parameter in my php.ini. Also all my PDF templates were working perfectly before upgrading to 5.8.2 - Now if you pay attention to the log info the script is trying to create a temp file outside the folder where espo is installed in my case ../crm - perhaps most people have the script at root level so they don't have any problems, so for what I can see the issue is related to the script being unable to create the tmp file within the script directory - What do you think yuri ? Thanking both in advance

          Comment

          • pmontanez
            Member
            • Dec 2016
            • 81

            #6
            Problem Solved - the issue was with the open_base directives, I had to make some changers in Apache .conf files ( No need to make changes to php.ini)

            Comment

            • bruce185
              Member
              • Feb 2016
              • 71

              #7
              I've had a similar problem on 5.8.4 and 5.8.5, I had to add ":/tmp" to the apache config... I was having trouble sending out new passwords...

              Comment

              Working...