Friday, June 22, 2012

HTTP Error 500 OR PHP Fatal error: Allowed memory size of xxxxxx bytes exhausted while trying to use MPDF

Error Message: HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

And

Error Message: PHP Fatal error: Allowed memory size of xxxxxx bytes exhausted (tried to allocate xxxx bytes) in C:\inetpub\internal portal\mpdf\mpdf.php

The default PHP install on Windows Server 2008 was set at 16 MB.  I updated it to 32 MB.  Keep trying until your pdf will load.  You don't want to go over board.  You also want to set it on that page so that PHP isn't always using that amount of memory.  You can do that by putting this in your php document.

ini_set('memory_limit', '256M');


Source: Link

ShareThis