Support » Fixing WordPress » Fatal Error – Allowed memory size exhausted

  • Many posts about how to solve this Allowed Memory Size Exhausted problem, but none of the solutions are working for me. Tried adding the “Memory Bump” plug in – solved the error for a day, but it came back.

    See many suggestions about increasing/adjusting the memory in the wp-setting.php file, the .htaccess file, the wp-admin/includes/template.php or the wp-configure.php file – I found those files, but don’t see a line that addresses a memory amount in any of them and I’m not sure where to add that line if I were to type it in. I also can’t find a php.ini file anywhere in our files.

    Looking for solutions so I can get back to editing my site. Please explain in simple everyday language as I’m a marketer still learning this technical stuff. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator James Huff


    Volunteer Moderator 🚀

    If you’re seeing this error either suddenly (no specific task was done to cause the error) or frequently, try deactivating all plugins to rule-out a plugin-specific issue and try switching themes to rule-out a theme-specific issue.

    Otherwise, here are three ways to increase PHP’s memory allocation:

    1. If you can edit or override the system php.ini file, increase the memory limit. For example, memory_limit = 128M

    2. If you cannot edit or override the system php.ini file, add php_value memory_limit 128M to your .htaccess file.

    3. If neither of these work, it’s time to ask your hosting provider to temporarily increase PHP’s memory allocation on your account. Keep in mind that most decent hosting providers allocate 64 MB to PHP under each account, and most decent hosting providers allow users to temporarily increase the memory allocation. If your hosting provider won’t accommodate you, perhaps it’s time to find a new hosting provider.

    (in the above examples, the limit is set to 128MB)

    Thank you James for your detailed answer. Just want to make sure I do your recommended steps correctly.

    For deactivating the plug-ins, would you turn them all off at once, check to see if the problem is solved and if it is, then start turning them back on one at a time? Or would you turn them off one at a time, check and then turn it back on before going to the next one?

    I don’t seem to have a php.ini file, so if I were to add the line you suggest to the .htaccess file (which I do have), does it matter where I add that line? First line, last line, or is anywhere okay?

    Thank you for clarifying these questions for me.

    Moderator James Huff


    Volunteer Moderator 🚀

    Try deactivating all plugins at once. If that resolves the issue, reactivate each one individually until you find the cause.

    I’d suggest adding this as the first line in your .htaccess file.

    Thanks James – I first tried adding that line as the first line in the .htaccess file and after I uploaded it, it crashed my site. So I took that line out and reuploaded it. Now the site is back up. I’ll tackle the plug-ins next.

    While I’m doing that, if this is helpful, here’s what my error message says:

    Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 19456 bytes) in /home/p14l37s2/public_html/wp-admin/includes/template.php on line 557

    I did look at the template.php file in the folders indicated, but line 557 didn’t mention memory at all. It said

    $r .= “\n\t\t<td class=’left’><label class=’screen-reader-text’ for=’meta-{$entry[‘meta_id’]}-key’>” . __( ‘Key’ ) . “</label><input name=’meta[{$entry[‘meta_id’]}][key]’ id=’meta-{$entry[‘meta_id’]}-key’ type=’text’ size=’20’ value='{$entry[‘meta_key’]}’ />”;

    Does this information make you suggest anything different than trying the plug-ins?

    Moderator James Huff


    Volunteer Moderator 🚀

    It has nothing to do with specific lines of anything, really. You’re hitting your hosting account’s memory limit, and whatever triggered at line 557 of template.php is what hit that limit.

    Something else could be using 99% of your hosting account’s memory limit, and poor line 557 just needed 2% more, for example.

    So, you need to find out either what’s hogging all of the memory or just increase your hosting account’s memory limit.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal Error – Allowed memory size exhausted’ is closed to new replies.