Fatal error: Allowed memory size of N bytes exhausted

Fatal error: Allowed memory size of N bytes exhausted, this happens when php code wants to allocate memory bigger than what’s allowed. To increase the allowed memory size, add the below before the code that’s going to use a lot of memory.

ini_set('memory_limit', '-1');

or give a specified size if you know how much memory the code needs

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

The memory limit can also be set in the php.ini file, which can be found from the echo phpinfo(); To set the memory limit in php.ini file, open the file and search for memory_limit and increase the value as needed in the below line:

memory_limit=128M

Search within Codexpedia

Custom Search

Search the entire web

Custom Search