The dreaded memory limit error, you may have seen it while you were reading your favorite blog, or you may have encountered it while working on your own WordPress website or blog. The error message may seem daunting but is in most cases easy to fix.
But first, let’s see what is causing this error. When do you get this error. Well, that’s easy, when the PHP code of your WordPress installation requires more money than is allowed by the server, or the default allocated memory, you get this.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
When installing WordPress, it will try to increase the PHP memory limit, and raise it a whopping 64MB!
But quite often, 64MB still isn’t going to cut it… How much will? Well, hard to say, it all depends on the size of your site, the number of plugins, the type of plugins, the number of concurrent visitors,…
So what to do next? Raise it yourself!
How? Well, there are a few ways to do this, let me list them up for you!
1. First of all, if you have access to the PHP.ini file, open it up in your editor (vi php.ini), search for the memory_limit setting, and set it to a higher number:
memory_limit = 256M;
2. Sometimes, you just aren’t lucky enough to have access to PHP.ini. But on those bad bad days, you can use .htaccess file in the root directory of your site:
php_value memory_limit 128M
3. Sometimes you can tell PHP to allow all the memory you want, but WordPress can have its own limits.   By adding this line to your wp-config.php file you should be able to fix that:
define(‘WP_MEMORY_LIMIT’, ‘128M’);
4. If all else fails, talk to your web host and check what they propose.
Some web hosts will not allow a too high memory limit. If that’s the case, you might want to do a comparison of possible different web hosts, and switch to one that better suits your needs.
Share via
Copy link