Yii Framework Forum: Error on PDF report. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Error on PDF report. Rate Topic: -----

#1 User is offline   Cristian V. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 23-November 14

Posted 23 November 2014 - 04:33 PM

Hi Everyone!

First than all, I'm a newbie! :D

I have an app on PHP, using Yii framework, and I'm getting some problems with the reports on PDF.

When the reports have many records, the app dies... But if I limit these results to 1000 records or so, everything works ok.

┬┐Any idea of this problem? ┬┐Should I make an extra configuration?

The generation of the records I'm doing as follows:

while ($i < 1000) {
if($i%2==0)
$html.='<tr class="odd">';
else
$html.='<tr class="even">';

$html.='<td class="td" align="left" valign="top">' . $dataProvider[$i]["Nombre"] . '</td>';
$html.='<td class="td" align="left" valign="top">' . $dataProvider[$i]["rel_idDepartamento"] . '</td>';
$html.='<td class="td" align="left" valign="top">' . $dataProvider[$i]["Codigo"] . '</td>';
$html .= '</tr>';
$i++;
}

Thanks, Regards!

Attached File(s)

  • Attached File  ERROR.jpg (53.15K)
    Number of downloads: 6

0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,670
  • Joined: 04-March 10
  • Location:UK

Posted 24 November 2014 - 08:30 AM

I'd guess that either the query is timing out or you're hitting PHP's memory limit.

If you've got access to the PHP ini file, you can update both of those settings there. Look for max_execution_time and memory_limit.

For reference, on my environment the relevant file is at /etc/php5/apache2/php.ini
0

#3 User is offline   Cristian V. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 23-November 14

Posted 24 November 2014 - 09:31 PM

Hola Keith,

Thanks for your help!

I modified these parameters:

memory_limit 512M (was at 128)
max_execution_time 45 (was at 30)

And the report works ok, but... In another report with more records (almost 3000) did not work. I don't know if it's advisable to keep increasing the parameters.

Again thanks, regards!
0

#4 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,670
  • Joined: 04-March 10
  • Location:UK

Posted 25 November 2014 - 09:29 AM

You need to try to figure out where all of the memory is being used. Are you loading lots of Active Record models at the same time? If so, you could load in batches of, say, 100 at a time, then unset and load the next batch.

If the PDF generator is eating all of the memory, there may not be much you can do other than raise the memory limit or find alternative PDF generation software.

Did you determine whether you're hitting the memory or execution time limit?
0

#5 User is offline   Cristian V. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 23-November 14

Posted 27 November 2014 - 07:18 PM

Ty Keith
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users