Remember the old days when your computer would crash because you were running too many applications simultaneously? Well, you might be surprised to know that WordPress can fall victim to the very same thing.
You see, your server may be packed with 4 GB of RAM, but that doesn’t mean that all 4 GB have been allocated to PHP on your account. In fact, most decent hosting providers only allocate 32 MB to PHP under each account. Now, most WordPress installations with a good amount of plugins will run fine under 32 MB, but there’s always a chance that one more plugin or one seemingly innocent admin panel task (like exporting or importing posts) may put you over the edge, and you’ll see either a blank screen or the infamous error which starts off something like “Fatal error: Allowed memory size of 33554432 bytes exhausted.”
If you see a blank screen, refer to WordPress and the White Screen of Death before continuing.
Update: Thanks to Big Dave Zatz for reminding me that if you see this error either suddenly (no specific task was done to cause the error) or frequently, try deactivating all plugins to rule-out a plugin-specific issue and try switching themes to rule-out a theme-specific issue.
If you see the infamous fatal memory error, there are three things that you can do before asking your hosting provider for assistance. Which method you use depends entirely on your server configuration. If one method doesn’t work, try the next. Keep in mind that most hosting providers closely monitor memory overrides and don’t take too kindly to frequent use.
1. If you’re using WordPress 2.9.2 or lower, try adding
define('WP_MEMORY_LIMIT', '256M'); to your wp-config.php file. If you’re using WordPress 3.0 or higher, WordPress automatically does this for a variety of tasks, so there’s really no reason to try it in this case.
2. If you can edit or override the system php.ini file, increase the memory limit. For example,
memory_limit = 256M
3. If you cannot edit or override the system php.ini file, add
php_value memory_limit 256M to your .htaccess file.
If neither of these work, it’s time to ask your hosting provider to temporarily increase PHP’s memory allocation on your account. Keep in mind that most decent hosting providers allocate 32 MB to PHP under each account, and most decent hosting providers allow users to temporarily increase the memory allocation. If your hosting provider won’t accommodate you, perhaps it’s time to find a new hosting provider.
As always, if you need further assistance, the volunteers in the WordPress Support Forums will be more than happy to help you.