Friday, 27 July 2012

Increase Memory Limit to resolve Server error while generating PDF using third party library like TCPDF

When generating a PDF using TCPDF or any of the third party PDF libraries, and if you find the following issues while generating pdf;

Server error The website encountered an error while retrieving It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this web page later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.

Solution: In that case, most probably, it would be memory limitation issue. So, you should increase the memory limit by adding the following code before the pdf generate code(the very beginning of the code).
/* Set the memory limit for the PDF. */
ini_set('memory_limit', '256M'); 

No comments:

Post a Comment

Please post any queries and comments here.