Cartier Consulting

"Fatal error: Out of Memory" in WordPress

WordPressIf you have ever dealt with this WordPress error, you are probably well aware of how frustrating it can be to troubleshoot. This can happen when you upgrade or install plug-ins in WordPress. In fact, simply upgrading the WordPress core installation to a newer version can produce this same memory issue.

The issue stems from a memory limit that is placed on the allocated PHP memory that your WordPress installation is allowed to use on the server. One of the fundamental purposes for this limit is web server security. How much space your particular WordPress installation is allowed to use depends on several factors, but the main one is whether or not your web space is located on a “shared” hosting server.

One way you can check the applied limit is to run a small php command in your web space. Create a new file named info.php (or whatever name you like) containing the following contents:

<?php phpInfo(); ?>

Now, upload this file to the root of your web space, an open it in a web browser. If you used the name “info.php” in the above example, then go to http://yourdomain-dot-com/info (where yourdomain-dot-com is the actual domain name of your web site). Scroll down in the PHP information page until you see a section entitled Configuration PHP Core. In this section look for a line that resembles the following:

memory_limit 40M (local value) 40M (master value)

These values indicate the effective memory limits placed on your hosting account.

If your WordPress installation is located on a dedicated (not “shared”) hosting server, you may be in luck. In this case, you typically have control over your php.ini file, which is where the memory limit is defined. You can usually find the php.ini file in the site’s root. Check with your web host if you don’t know where it is. There are some good articles discussing how to change the PHP memory limit in the php.ini file, an .htaccess file, or even in the wp-config.php WordPress configuration file. You can find one of these articles here.

If your WordPress installation is located on a “shared” hosting server, you may find that making changes to your wp-config.php, .htaccess, or php.ini file does not increase the available memory in your web space. Typically, on a shared hosting plan, the server has fixed limits here. If you have shared hosting, your web host is unlikely to increase this limit for you, as it is usually equally applied to all the shared hosting accounts on a particular server.

If you (like me) have a shared hosting plan, and you encounter this error, there is still a way to address this when none of the other suggestions work. The simplest solution of all is to review your installed plugins and uninstall any you are not using. You can look at total file sizes and remove the largest ones that you don’t use or can live without. You may be surprised to find that one or more of your plugins are a few to several megabytes in size. These files can add up quickly in your WP installation…

This worked for me and fixed the Fatal error I was getting when trying to upgrade a couple of plugins in my WP installation…


1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 5.00 out of 5)


One Response to “"Fatal error: Out of Memory" in WordPress”
  1. John says:

    Different web hosts have different memory limits on their shared hosting servers. It’s important for hosts to set some limit, because otherwise, one impolite script could cause problems for other customers sharing the same memory resources.

    You can and should ask your hosting company what the limit is, and whether it can be raised on a case-by-case basis.

Cartier Consulting
%d bloggers like this: