1

I have an error 500 with this code:

require_once FCPATH.'application/helpers/dompdf/dompdf_config.inc.php';
$dompdf = new DOMPDF();
$dompdf->load_html( $html );
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents( './tmp/'.$filename.'.pdf' , $pdf );

With some debug, I find that the "evil" code is this

$dompdf->load_html( $html );

And I don't know how to solve this.

Even the "ini_set" instruction with memory_limit and max_execution_time doesn't fix this problem..

Andrea Rastelli
  • 617
  • 2
  • 11
  • 26

1 Answers1

0
  1. Follow the advice in this SO question. PHP is probably bubbling the error up to Apache.

  2. Check the permissions on the file and parent folders of application/helpers/dompdf/dompdf_config.inc.php, ensure they are readable.

  3. I believe that if you see a 500 error in the access log, there will also be a report in the error log. If not, the error is coming from PHP. Check your server logs. See /var/log/apache2/error.log and var/log/apache2/access.log on Linux.

Community
  • 1
  • 1
Jordan Arsenault
  • 7,100
  • 8
  • 53
  • 96