Support » Plugin: WP Post to PDF Enhanced » Fatal Error Issue

  • Hi,

    Thank you for this plugin. It has been working great for all the years that we’ve been using it, but it doesn’t seem to be working anymore. The error I’m receiving when someone clicks on the PDF icon to view the PDF file is:

    Fatal error: Call to undefined function mb_detect_encoding() in /home/xxx/public_html/CM/wp-content/plugins/wp-post-to-pdf-enhanced/simplehtmldom/simple-html-dom.php on line 988

    Is there any way I can rectify this line to prevent this error from occurring?

    I’d greatly appreciate your help.

    Thank you!


    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lewis Rosenthal


    Thanks for your kind words. I’m glad this plugin has worked well for you, as it has for many others. One of these days, I really want to get back to it, as it is long overdue for an udpate to the PDF class (at least), and some more code cleanup for newer versions of PHP.

    The error you report seems to be a failure of PHP’s mb_detect_encoding(), rather than a particular defect in the simple HTML DOM component. What version of PHP is this? Is mbstring installed/enabled?

    Thread Starter qfactoralpha


    Hi Lewis,

    Thank you so much for your prompt response.

    The site is running on a PHP version of 5.6.30.

    How do I check if mbstring is installed or enabled? Considering it was working all this while, would it be possible that it was?

    Plugin Author Lewis Rosenthal


    Well, ordinarily, I’d say, no, it’s not logical for things to just stop working. However, there are a number of reasons that might happen.

    A good place to start checking on the status and health of the PHP engine is with phpinfo():

    You should see that mbstring is enabled.

    The Simple HTML DOM third-party component used in the extension merely calls mb_detect_encoding() which itself is a function provided by the mbstring PHP extension. So, what you are seeing is likely only a symptom of the problem, and not a problem within the plugin itself (if you were to run something else on the server, such as phpMyAdmin, you would probably receive the same error, as phpMyAdmin also requires mbstring to be enabled).

    What probably happened is that something is either keeping the mbstring extension from being loaded (or found), has removed it from the list of extensions to load in php.ini, or the server is running out of resources somehow, making it impossible for mbstring to function.

    Start your research on the basic error message reported:

    Call to undefined function mb_detect_encoding()

    There are lots of search engine hits for this issue. Check the php error log, assuming you have it enabled, and also the web server error log for some clues. In any event, this isn’t something we can address in the plugin code. We need the Simple HTML DOM parser component to dissect the elements on the page to hand off to the PDF engine. Simple HTML DOM has a dependency upon mbstring. If mbstring’s functions aren’t available, that’s what needs to get fixed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal Error Issue’ is closed to new replies.