Problem generating PDF with DOMPDF

0

I have the following code

<?php

    require_once("../../../VISTA/conexion.php");
    require_once '../../../FRAMEWORKS/dompdf-master/lib/html5lib/Parser.php';
    require_once '../../../FRAMEWORKS/dompdf-master/src/Autoloader.php';

    Dompdf\Autoloader::register();


$codigoHTML ='<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
</head>
<body>


<div> 

        <center>
            <table class="table table-bordered">
              <tr>
                <th>ID</th>

                </tr>
              ';       


               $sql = "SELECT * from socios;";
               $resultado = mysqli_query($conexion,$sql);

               while($filas = mysqli_fetch_assoc($resultado)){
                $d = $filas["idsocio"];
               $codigoHTML .='<tr><td>'.$d.'</td></tr>';
               }
              $codigoHTML .='

            </table>
        </center>                        
</div>
</body>
</html>';





//reference the Dompdf namespace

use Dompdf\Dompdf;

$codigoHTML=utf8_encode($codigoHTML);
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($codigoHTML);

// (Optional) Setup the paper size and orientation
$dompdf->set_paper('A4', 'portrait');
//Cambiando la fuente
$dompdf->set_option('defaultFont', 'Courier');

// Convertir the HTML as PDF
$dompdf->render();
// Descargar el PDF generado
$dompdf->stream("Reporte_usuarios.pdf");

 ?>   

With this code working locally, it does not generate any errors, it generates me the pdf correctly but when I upload it to hostinger it throws me internal error, and it does not generate any pdf, now removing the part of the query from the database Is it generated correctly, any idea why this happens?

    
asked by Adrian 10.07.2018 в 19:53
source

0 answers