php - DomPDF render of large HTML file results in 500 error -
i'm using recent version of dompdf (0.6.0 beta 3).
php version 5.2.17.
unfortunately, i'm on shared hosting account , upgrading php , similar actions unavailable. don't have access apache error logs, don't think helpful anyways.
i've set memory_limit
of php 2048m
, max_execution_time
999
. although don't know if they've taken effect. think don't matter because feel dompdf isn't timing out or running out of memory. 500 error seems occur 10 seconds after requesting page, when attempt generate pdf fewer pages script takes longer (12-15 seconds) ends successfully.
i have html file that's 72.3kb large, 1 small html table. (in fact, removing page table nothing problem.) pdf should result in 35 pages.
after lots , lots of digging found error occurs on 30th - 31st page, on following line of code in page_frame_reflower.cls.php
inside reflow
function:
// render page $this->_frame->get_renderer()->render($child);
when echo
ing memory_get_usage
on each loop(page) value stays pretty consistent, under 5% of available memory, seems.
using get_class
on $this->_frame->get_renderer()
able determine problem function renderer::render()
.
unfortunately, there's no easy way me continue debugging current methods. method renderer::render()
won't let me add counter variable parameters because needs compatible it's parents function.
anybody got me, see i'm missing - can point me in right direction fixing these 500 errors?
edit: i've removed uses of inline php html document, , didn't seem change anything.
edit 2: document large run through tidy, 50000 bytes had no errors.
edit 3: php error logging has been turned on. can generate errors calling wrong method names , other things. errors appear on screen. in fact, when cause infinite loop before problem method, php maximum execution time reached errors printed screen. problem area shows 500 internal server error page.
edit 4: stripped out of css , pdf generated without styling. we're getting somewhere. i'll add css in , can narrow down problem code. thanks, @liv.
edit 5: narrowed down css bud of problem: h1 rule. using background image on h1 tags. original problem, had remove background images h1 tag pdf work properly. handling lot of elements background images problem dompdf?
edit 6: here's html file: http://www.pickering-mcaloon.com/wp-content/uploads/2013/03/test2.html had strip out content (wasn't mine). tested version of html dompdf , got 500 server error. header image 25.1 kb. should noted footer of every page uses background image , works fine. in copy of html, removing 1 "chapter" section permitted dompdf finish generating pdf.
edit 7: when first ran problem had used memory_get_usage
, @ top of loop renderer::render()
called, each time showed different usage, under 6% of max, set 2048m
. don't believe problem timeout error or memory error, because can produce these types of errors before call render
, php errors printed screen. also, 500 error appears after 10 seconds of runtime - when pdf works takes 15-20 seconds. timeout unlikely. memory errors, perhaps if why not print error if memory overflows before call render
.
edit 8: converted image using background image h1 tags jpg png, reduced size 25.1kb 2.6kb , pdf generated properly. memory issue. php should generate error , show me, doesn't.
the same problem facing , still working on it. using dompdf , trying convert html page of 33kb 500 internal server error.
i have multiple external style sheets in html page under head section including bootstrap css. when remove bootstrap css , dompdf works fine.
removing line may --> link type="text/css" rel="stylesheet" href="/bootstrap.css"
but not know should done in order include bootstrap.css dompdf , why bootstrap style causing error dompdf.
Comments
Post a Comment