Error on PDF report.

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) {


	&#036;html.='&lt;tr class=&quot;odd&quot;&gt;';


	&#036;html.='&lt;tr class=&quot;even&quot;&gt;';

	&#036;html.='&lt;td class=&quot;td&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;' . &#036;dataProvider[&#036;i][&quot;Nombre&quot;] . '&lt;/td&gt;';

	&#036;html.='&lt;td class=&quot;td&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;' . &#036;dataProvider[&#036;i][&quot;rel_idDepartamento&quot;] . '&lt;/td&gt;';

	&#036;html.='&lt;td class=&quot;td&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;' . &#036;dataProvider[&#036;i][&quot;Codigo&quot;] . '&lt;/td&gt;';

	&#036;html .= '&lt;/tr&gt;';



Thanks, Regards!

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

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!

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?

Ty Keith