I’ve been making some changes to this site recently: upgrading to the newest version of WordPress, choosing a new theme and fiddling with the layout.
One thing I discovered is that, unless you’re running a very minimal installation, it’s quite easy to run out of memory, even with only a handful of plug-ins. Versions of the software have become slightly larger since WordPress 2.6 or so, plus plug-ins have become more ambitious, not to mention the increased usage of rich content like videos and AJAX transitions.
Every time I tweaked something, I ended up with blank pages and an error message like this:
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes) in /home /Your-Username/public_html/ the particular folder on line X
I searched around for quite some time for advice, and tried each of the following, before ending up at a working solution. They didn’t work for me, but I’ll leave them here since they might prove useful for someone else. Please be very careful, though: some of these ‘handy tips’ will break your entire site.
1) De-activating all but the most essential plug-ins. This is probably good housekeeping advice all-round, but didn’t actually make a lot of difference. The basic install was using 26MB of the 32MB allocated; with a full suite of plug-ins it was just over 28MB. Add some users, and you’ll quickly run out of memory — the extra 2MB from disabling plug-ins didn’t make enough difference.
2) Alter the value of php_value memory_limit in your .htaccess file. Doing this broke the whole site: YMMV.
3) Optimise your database tables using phpMyAdmin. Saved about 200KB. Woop.
4) Adding the line “memory_limit = 64M” in my php5.ini file. Made no difference one way or another.
What actually worked was this.
Open wp-config.php and find this bit:
/** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
Change it so that it reads like this:
/** Sets up WordPress vars and included files. */
define('WP_MEMORY_LIMIT', '64M');
require_once(ABSPATH . 'wp-settings.php');
Touch wood, that’s done the trick. The site’s still as slow as molasses, of course, but at least I’m not running out of memory.























thanks for this — happy holidays :D
np, Konig.
You just saved me hours with this post and fixed a problem that was causing me no end of grief! THANK YOU! THANK YOU!
very pleased it was helpful — I had to refer to it again myself the other day after my hosting company reset all my ini files.
top man worked was driving me nuts.
other solution (you can translate) : http://www.twiz.fr/school/tuto/webmaster/wordpress-out-memory/