Wordpress Tips  

Is your wordpress two slow?  did you get an error that display not enough memory to run current script?did you get error like this one?

Fatal error: Allowed memory size of 8388608 bytes exhausted.

or PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 6233929 bytes) in /home/…/press/wp-includes/cache.php on line 330

or Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 368640 bytes) in /wordpress/wp-includes/class-simplepie.php on line 9575

Then you are lucky to be here! Here are four solution to increase your WordPress memory

  1. If you have access to your PHP.ini file, change the line in PHP.iniIf your line shows 32M try 64M or even 128M:
    memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
  2. If you don’t have access to PHP.ini try adding this to an .htaccess file:

    php_value memory_limit 64M
  3. Try adding this line to your wp-config.php file:Increasing memory allocated to PHP
    define('WP_MEMORY_LIMIT', '64M');
  4. Talk to your host!

Update: Monitor real WordPress memory usage:

do you know how much memory your WordPress needed? how much is your pick WordPress memory usage?
If all need memory for your wordpress is 10M. Why you should be worry to set it to 64M? Thats true I found My pick memory usage was just 8M! That is why wordpress default memory usage is only 32M which is more than enough.

Here are two plugin that let you to monitor and know your WordPress current and pick memory usage.
try them before changing your WordPress memory usage to higher value.

  • http://wordpress.org/extend/plugins/wp-memory-usage/
    Simple and light. Show up the PHP version, memory limit and current memory usage in the dashboard and admin footer. You can now simple measure the requirements of your plugins and language files
  • http://wordpress.org/extend/plugins/tpc-memory-usage/
    More advanced with more report. view the current and peak memory usage of the application. This is extremely helpful when testing new plugins, or if there are a lot of modifications, plugins, or large language files. As of version 0.4, administrators now have the ability to view detailed system information about their web server, MySQL, PHP, and WordPress software. (Requires PHP5)

After Using above plugin I noticed my PHP memory is set to 128M and my max  WordPress memory is set to 32M

Note: If you add  define(‘WP_MEMORY_LIMIT’, ’64M’); to the end of WP-config.php it do not work. You have to add it to at top of wp-config.php file (at root of your wordpress directory). here is the final result:

As you see in above screen-shot, My WordPress Memory  limit is set to 64M which is more than enough.

Here is how modified wp-config looks like:

If you are wonder what are rest of the extra gray lines , continue reading simple ways to make youe wordpress faster

Try same yourself. In nutshell you need to do following steps:

  1. Check your current  memory by using above  plugins
  2. set php.ini memory to higher if needed.
  3. Set WordPress Memory to a value equal or less that php.ini memory
  4. Check your change is working or not ( by using  above plugins)

If still you had difficulty let me know to help you.

Do you need farther help on this topic? Contact me
Do you need Professional coder? Hire me
Looking for different WordPress plugin? Try Wishlist member

Andy is one of core WordPress WishList Member Developer. He is in love with WordPress and fun of turning new ideas to WordPress plugin or theme.

Alternative Cron

Use this, for example, if scheduled posts are not getting published.
According to Otto's forum explanation, "this alternate method uses a redirection approach, which makes the users browser get a redirect when the cron needs to run, so that they come back to the site immediately while cron continues to run in the connection they just dropped. This method is a bit iffy sometimes, which is why it's not the default."

define('ALTERNATE_WP_CRON', true);
define('DISABLE_WP_CRON', true);

Add your comment

  1. kobizeit
    April 14, 2010
    11:58 am

    Thanks, your solution 3 worked for me.

  2. Andy
    April 14, 2010
    12:46 pm

    Hello kobizeit,

    I’m glad to hear it helped your wordpress enjoying more memory.


  3. I actually got some info here, See here How to increase wordpress memory limit, I tried number #3, very helpful. Thank you.

  4. Eyl
    July 6, 2010
    3:43 am

    thanks, my meory limit is changed to 64MB but the fatal error still appear. im using wordpress 3.0 with mystique theme.

  5. Andy
    July 10, 2010
    4:35 pm

    WordPress Works well with 32MB. yours is great memory. problem can be from incompatible plugins with theme.Try deactivating all plugins

  6. Carlo
    August 14, 2010
    1:34 pm

    Great post bro!
    My compliments.
    A blank page also indicate to increase your php memory limit, right?


  7. Andy
    August 18, 2010
    8:46 am

    Yes Carlo! blank page also indicate to increase your php memory limit.

  8. Todd
    March 31, 2011
    7:12 pm

    Hi Andy,

    I am using WordPress 3.05 and have my memory set to 128M which seems to be more than enough. I also change the permissions of the wtc7uploads folder to 777 to make it writable to anyone, but the contact form 7 plugin will not work. Each time try to upload an image of more than 1mb to through a form on our website, I keep getting that exhausted error. I’ve been trying all the things you mentioned above but no luck. Do you have any ideas what it can be that is causing this exhausted issue. Thank so much.

  9. Andy
    April 9, 2011
    9:09 am

    Hello Todd,

    It might be limit of your php ini max file upload size. Try to increase upload size in your php.ini

    For example, Here are two ways to increase the limit on uploaded files to 20 MB:

    *1) Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your domain root directory.
    o upload_max_filesize = 20M
    o post_max_size = 20M
    *2) OR add the below to your .htaccess file in your Drupal root directory.
    o php_value upload_max_filesize 20M
    o php_value post_max_size 20M

    I hope it Helped.

  10. Yan
    June 14, 2011
    2:55 am

    It’s worked for me…
    Thanks a lot, but can you tell me about where I can find my php.ini? I mean the location of the file….

  11. Valentin
    July 27, 2011
    3:07 pm

    In the last Version of TPC Memory usage, you can see a new parameter. WP Memory. In my case Look image below. Yo can apreciate that my WP Memory is 32 MB and PHP is 64 MB.

    Can I increase the 32 Mb of WP Memory?


  12. Andy
    July 27, 2011
    3:15 pm

    Try adding this line to top of your wp-config.php file:
    define('WP_MEMORY_LIMIT', '64M');

  13. awwab
    September 13, 2011
    10:34 am

    Thanks its worked

  14. Steven Myers
    October 2, 2011
    3:52 pm

    THANK YOU SO MUCH! I was having issues with the pages becoming blank after saving the changes, emptying cache and etc in the admin panel.

    Adding the: define(‘WP_MEMORY_LIMIT’, ’64M’); (To the wp-config.php right above: define(‘DB_NAME’, ‘dbname’); worked perfectly!

  15. Boyuancy
    November 6, 2011
    12:45 pm

    Yes Valentin is right you have to add a “define” before the “(‘WP_MEMORY_LIMIT’, ’64M’)”


  16. Sajan Abbas
    December 21, 2011
    12:30 pm

    Thnx it works 4 mine wordpress

  17. lalit
    May 7, 2014
    12:07 pm

    thanks for asking to not add the wp_memory limit to bottom

    one little mistake is the varaibles arent enclosed in single quotes , so i got blank page after this update to wp-config file.

    please edit it,ideally it should be
    define(‘WP_MEMORY_LIMIT’, ’64M’);

  18. Ptutorial
    February 18, 2015
    6:09 am

    Thanks for got this idea….

RSS feed for comments on this post. TrackBack URL

Add your comment.