This is a very common Error if you have a big site in WordPress. Mostly site with huge post count suffers in this error. It could occur while posting new or editing any existing post. I also had this error while creating large sitemap, doing some batch function. You will see any empty screen with the message below –

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 80 bytes) in /home/*****/public_html/wp-includes/wp-db.php on line 958
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 80 bytes) in /home/*****/public_html/wp-includes/wp-setting.php on line 958

It occurs as WordPress tries to access more memory then its allowed to by “Server PHP configuration” or “WordPress Setting”. Increasing Memory will solve it. Here is solution for all user, who have shared hosting or dedicated or VPS, just FTP access to server will be enough.

Here is Solutions:

*** Here we consider 64M as good configuration. Depending on your need, server condition, how is your site, you could use 32M, 96M, 128M, 256M, 512M, 1024M, 2048M, 4096M. Make sure your server allow you to use that much dedicated memory.

1. Try adding this line to your wp-config.php file:
define(‘WP_MEMORY_LIMIT’, ’64M’);

2. If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

3. If you don’t have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M

4. Contact your web host support or the person manage your server.

28 thoughts on “Solution to “Fatal error: Allowed memory size of 67108864/33554432 bytes exhausted”

  1. Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 146 bytes) in /home/content/63/11644263/html/countdown/wp-content/plugins/ninja-forms/deprecated/ninja-forms.php on line 870

  2. Fatal error: Allowed memory size of 54525952 bytes exhausted (tried to allocate 384 bytes) in /mounted-storage/home95a/sub006/sc50103-BRVL/jedian-sd.com/global/wp-admin/includes/comment.php on line 20

  3. Hi! To your list of solutions I would add one more option: to edit the file .htaccess of the WordPress installation, adding the following line:

    php_value memory_limit 64M

    If necessary you can put 128M (that was my case).
    This is the solution that worked for me.
    Greetings!

  4. i have change it to 64 but still its giving error

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 868560 bytes) in /home/****/public_html/wp-admin/includes/admin.php

  5. After doing this I ended up with another problem. The white screen of death. Be careful guys when playing around with code. Back up the files you’re editing. I restored the backup, edited again and it was all fine.

  6. Hi there,

    I tried these instructions and it didn’t work. Only instruction I couldn’t follow was an update to the php.ini file, I couldn’t find it…

    To get the error, I went to dashboard > users > screen options and changed the limit to view users from 200 to 999… I then got the dreaded message.

    I have whm, so I upgraded the host package to utilise unlimited memory, this didn’t help either.

    I followed these instructions and others to help:

    1. Try adding this line to your wp-config.php file:
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    I did this and also changed the suthentication keys, but this did not help

    2. If you have access to your PHP.ini file, change the line in PHP.ini
    If your line shows 32M try 64M:
    memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

    Unfortunately I could not find this file

    3. If you don’t have access to PHP.ini try adding this to an .htaccess file:

    php_value memory_limit 64M

    This instruction took down the website….

    I have contacted my host for help, but can only hope for the best…

  7. Thanks very much. The perfect solution for Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 80 bytes) in /home/*****/public_html/wp-includes/wp-db.php on line 958

    361 inedtrat

  8. Hi Mr Asif,
    Thanks for the above recommended approach to memory
    problem.My own problem is that i don’t have access to the blog when trying to FTP. Could you please
    tell me what to do to have access to the config.php file.
    Please iam new to the system.

Leave a Reply

Your email address will not be published. Required fields are marked *