Prestashop Fatal error: Allowed memory size exhausted
I was testing Prestashop yesterday after installing on my server. At first there was some issues with fsockopen and mod_rewrite. Both were fixed after updating the php.ini file.
The another error surfaced when I tried to generate a PDF invoice and delivery slip.
When you try to view Orders in the back office, and click on the ‘View Invoice’ button, it opens a blank window, trying to generate the PDF, but eventually gives me a HTTP500 error. Seems like the allowed memory size of 32M is not enough to generate the PDF. Kept getting the error Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 39 bytes)
Found out the only way to resolve it is to increase the memory_limit to at least 64M. Informed backend about the issue and they agreed to increase the value for me. Finally I’m able to generate the PDF.
Out of curiosity, I went snooping around the PHP.ini documentation and guess what? I found out besides asking backend to increase the memory_limit, there another workaround. It can also be done by editing the settings.inc.php and insert the line ini_set(‘memory_limit’,’64M’);
But take note, if you are in a shared environment, backend usually unable to increase the global memory limit, meaning that even if they change your local php.ini memory limit you will still be restricted by the global settings