Fatal error: Allowed memory size of 134217728 bytes exhausted...

5,270 views
Skip to first unread message

Aagaard

unread,
Jul 27, 2009, 9:06:39 AM7/27/09
to dompdf
I get an error when trying to call:
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("test.pdf");

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
to allocate 37 bytes) in /var/www/crm.changenetworks.dk/htdocs/
sugarcrm/include/pdf/dompdf/include/cellmap.cls.php on line 321

It differs from which file the error occurs in, but the error is the
same everytime.

The $html contains valid html for a table with 20 columns and 200 rows.

Beto Ees

unread,
Jul 27, 2009, 10:53:35 AM7/27/09
to dom...@googlegroups.com
you have to change the memory limit php, can use this line on your code
$old_limit = ini_set("memory_limit", "30M");

2009/7/27 Aagaard <henrikaaga...@gmail.com>:

Dimas Yusuf

unread,
Jul 27, 2009, 1:33:53 PM7/27/09
to dom...@googlegroups.com
Btw, I believe this line is in dompdf.php... Since removed in version 0.5.2 (?)

Henrik Aagaard Sorensen

unread,
Jul 28, 2009, 3:01:21 AM7/28/09
to dom...@googlegroups.com
When adding the line:
$old_limit = ini_set("memory_limit", "30M");
it doesn't report the error anymore, BUT instead of creating the PDF
file "test.pdf" it downloads the PHP document instead?

2009/7/27 Dimas Yusuf <dimas...@gmail.com>:

Beto Ees

unread,
Jul 28, 2009, 8:41:23 AM7/28/09
to dom...@googlegroups.com
check your parameters
for example:
<?
require_once("dompdf/dompdf_config.inc.php");
$old_limit = ini_set("memory_limit", "30M");
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->set_paper('a4', 'portrait');
$dompdf->render();
$dompdf->stream("final.pdf");
?>

2009/7/28 Henrik Aagaard Sorensen <henrikaaga...@gmail.com>:

BrianS

unread,
Jul 28, 2009, 12:38:36 PM7/28/09
to dompdf
On Jul 28, 3:01 am, Henrik Aagaard Sorensen
<henrikaagaardsoren...@gmail.com> wrote:
> When adding the line:
> $old_limit = ini_set("memory_limit", "30M");

This isn't the setting you would want to use. Your old limit was
134217728 bytes, which is 128M. You should only need to use this
setting if you want to increase the memory limit that applies to PHP.
So you might try 192M or 256M ... if you have the memory available.

Even so, I think the real problem is that DOMPDF is just having
trouble handling your table. DOMPDF, even in the beta release, is
still fairly inefficient in its handling of large, multi-page, and
nested tables. Your table (20 columns, 200 rows) may just be too much
for DOMPDF to handle. If increasing your memory limit doesn't help,
you might try breaking your table up into a few different tables (if
you are able to do so).

On Jul 27, 1:33 pm, Dimas Yusuf <dimas.yu...@gmail.com> wrote:
> Btw, I believe this line is in dompdf.php... Since removed in version 0.5.2
> (?)

You are correct. This setting was removed from dompdf.php because this
setting would override the user's system settings, even if the system
setting was larger.
Reply all
Reply to author
Forward
0 new messages