PHP Fatal error: Allowed memory size of XXXX bytes

December 11, 2010 / Tech Support

Sometimes you may see the error message like – “PHP Fatal error: The allowed memory size of xxxxx bytes exhausted (tried to allocate xxxxxxx bytes) in Unknown on line 0? while accessing some PHP pages which indicates that those PHP files require more memory for it to execute than the one specified in php.ini file. If the memory_limit value is manipulated in the server-side php.ini file, it will be applied to all the PHP files server side.

To overcome the error without modifying the server-side php.ini file, you need to use the ini_set function to increase the memory limit by inserting the following code in the PHP file itself. Keep on increasing the memory limit unless the error disappears.

ini_set(”memory_limit”,”64M”);

Spread the love