Solve PHP Fatal error: Allowed memory size of 8388608 bytes exhausted Print

  • 0

 This error message can spring up in a previously functional PHP script when the memory requirements exceed the default 8MB limit.

This will server wide increase memory limit to 12MB.

  • nano php.ini
  • change "memory_limit" from 8M to 12M
  • Restart apache

 

This will change the memory use for 1 script to 12MB

  • To change the memory limit for one specific script by including a line such as this at the top of the script:
    ini_set("memory_limit","12M");

The 12M sets the limit to 12 megabytes (12582912 bytes). If this doesn't work, keep increasing the memory limit until your script fits or your server squeals for mercy.


Was this answer helpful?

« Back