How do I deal with “Fatal error: Allowed memory size of…” errors?

Here is an example of such an error (this may either be showing on your website, or just logged in your PHP logs, whilst your website has a blank screen):

Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 98304 bytes) in D:\Hosting\4662999\html\wp\wp-admin\includes\post.php on line 281

This is not particularly an UpdraftPlus error. It means that the PHP install on the webserver that your WordPress site is on reached its configured memory limit. What that means is that your site has plugins that need more memory than your setup is configured to allow.

If it happened when you installed UpdraftPlus, then it means that you were previously running very close to the limit, and one more plugin was enough to tip you over the limit.

To resolve this, you just need to tell WordPress to increase the limit. To do that, edit the wp-config.php for your site and add a line like this one; add it after the opening <?php at the top. Anywhere after that is fine (but not at the very end, where it will take no effect):

define('WP_MEMORY_LIMIT', '256M');

If the error comes when restoring/migrating, then you should also add this (which allows even more memory to the admin dashboard):

define('WP_MAX_MEMORY_LIMIT', '384M');

If you are not sure of how to do this, then ask your web hosting company for help, and they should be able to assist. If your memory limit was already 256M, then raise it to something higher, e.g. 512M, etc.

If seen when restoring/migrating

If you see the error whilst restoring your site, then it probably means you have a very large file to unpack (the maximum memory needed is approximately the amount of memory used by WordPress generally, plus the size of the largest file). You will need to raise your memory limit to at least that.

If the largest file is in your “uploads” (which is where very large files are likely to be), then you can just restore the uploads manually – i.e., don’t include the uploads in your restoration (do the restoration without it). Then, afterwards, unzip that zip on your PC and use FTP to move the resulting “uploads” folder into wp-content (so that it becomes wp-content/uploads – remove any existing such directory first… but if you have multiple uploads zips, then you’ll instead need to upload the contents of each in turn).

Posted in: Troubleshooting

twitterlinkedingoogle_plusFacebook