WordPress struck by memory loss

Allowed memory size of xxx bytes exhausted in WordPress

Well it has been a while since I have done up an article but this one has bugged me to many times as of late and every time I look to see what has been done it seems no one has the correct answer. So I thought I would put it out there to find for everyone.. And for my own reference later on.

Ok here is the standard error “Allowed memory size of 268435456 bytes exhausted (“tried to allocate something here” bytes) in /wp-includes/some file on “pick a line”. This can be just about anything to a white screen of death to your widgets not loading properly to half a page login. Whatever the reason you have pretty much hit the memory limit if only for an instant.

WordPress struck by memory lossSo what do you do well first thing to do is panic of course (just kidding) don’t panic. There is a simple fix to this irritating problem. Or several fixes to this problem that may work out for you. But the big secret is this one fix that generally gets the job done..

So what has happened well your hosting provide has set a limit on the memory allocation in php execution or you have hit the default limit set in WordPress. This may have happened because you listen to my podcast at WPPlugins A to Z and added one to many plugins to your site.

So what need to be done to fix this issue well here are the steps and individual files as you should try them..

First fix the default setting in WordPress by downloading your wp_config file and adding this line to it:

define( ‘WP_MAX_MEMORY_LIMIT', ‘256M' ); (as a side note here if you cut and paste you will need to fix the quotes)

add it near the top of the file right after the credits

Upload it and see if your problem is solved if not try increasing the number to 512 if that does not work you will need the next fix.

The next fix is to create a php.ini file for your website all good hosting providers allow you to do this if yours does not then consider changing hosting providers to a good one like Bluehost or GreenGeeks.

Here is what you need to do to create a php.ini folder:

Open a text document then place this in it (without the dots)

  • memory_limit = 256M
  • upload_max_filesize = 333M
  • file_uploads  = on
  • post_max_size = 333M

Save as “php.ini” use the quotes to force the file name.. Then upload it to your WordPress root..

 

So what happens if this does not work well then you need to have a talk with your hosting provider or as I said above find a better hosting provider which allows you to do things on your own.

That’s about it have fun..

1 reply

Comments are closed.