mPdf 7 does not work on the server

Asked

Viewed 299 times

0

Hi,

I have in my machine the mPdf v.7 that works normally, but when I go up, it’s giving an error that seems to be related to deprecated call methods.

Deprecated: Methods with the same name as their class will not be constructors in a Future version of PHP; mPDF has a deprecated constructor in /home/meusite/public_html/folder/mpdf7/mpdf.php on line 89

The point is that in my machine I have the PHP 7.3 and online is 7.1, I mean, my PHP is more current and still works normally.

I tried to:

public function __construct(mPDF $mpdf){ 
    $this->mpdf = $mpdf;
}

And gave another error, related to using 'public''

My code that works offline:

<?php
include('mpdf7/mpdf.php');
ob_start();
?>

<html> ... </html>

<?php
    $html = ob_get_clean();
    $mpdf = new mPDF();
    $mpdf->SetDisplayMode('fullpage');
    $mpdf->WriteHTML($html);
    $mpdf->allow_output_buffering = true;
    $mpdf->Output('documento.pdf', 'I');
    exit;
?>
  • Buddy, take a look at this link, maybe it’ll help you.

  • In the link, explains that they are for future versions of PHP, only that on my machine PHP is more current than on the online server and even so works :(

  • [SOLVED] These are the PHP requirements that must be configured on the server, as described in: https://packagist.org/packages/mpdf/mpdf

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.