WordPress is a very powerful content management system that allows users to create and manage a wide range of websites from simple blogs to complex ecommerce stores. However due to these capabilities, more in-depth technical knowledge is sometimes required to fix issues that may come up during the day to day management of your WordPress website.
One of the most common errors users come across is a message that states “Allowed memory size exhausted.” Thankfully, increasing the WordPress memory limit is quite a straightforward process and can be achieved in a number of ways.
In this article, we’ll cover the three most common ways to increase your WordPress Memory Limit and resolve this error once and for all. But first, it’s important to understand what causes this error and what can be done in the future to reduce the chances of it happening again.
Why Am I Getting This Error?
Upon the initial setup of your WordPress website you will have purchased a hosting plan for WordPress to get your site online. If you’re not sure where you purchased this from, it is often the same place as where you bought your domain name from but may have also been recommended to you by your web developer.
Depending on where you purchased your hosting from and which plan you chose, your website will have been allocated a certain amount of resources by the web hosting provider. These resources are what powers your website and sometimes when carrying out resource-intensive actions (like uploading lots of files to the media library or installing a new theme/plugin) you may run out of available ‘memory’. This may be what causes the error to display.
How Much Memory Do I Need for My WordPress Website?
The default PHP memory limit for WordPress is 32MB but it’s not uncommon to need to increase it beyond this.
If you run an ecommerce store using Woocommerce for example, the recommended memory limit is 64MB to minimise the chances of your website running out of memory.
How Do I Increase My WordPress Website Memory Limit?
There are multiple different ways to increase the memory limit in WordPress, and since this is partly down to how your hosting environment is configured, there’s no surefire way to guarantee all of them will work for you. However, at least one of the following three methods should work so that you can get your site up and running again! If not, you should contact your hosting provider for further assistance.
1: Editing the wp-config.php file
The first approach we’ll be suggesting is to edit the wp_config.php file. All WordPress installations will have one of these and in order to access this you will need to access your site via an FTP Client such as Cyberduck or FileZilla.
Disclaimer: As this approach involves editing important code for your website, we recommend that you take a backup of your site, or at least the file you will be editing (wp-config.php) before attempting this method.
Firstly, connect to your site via FTP (using a client such as FileZilla or Cyberduck). If you are not sure on how to do this, please read our guide [link]here[/link]. You should then see a list of files like those in the screenshot below. If not, look for a “public_html” directory that you can click to enter.
Look for the wp-config.php file (highlighted in the above screenshot) and download this to your computer. You will then need to open this in a code/text editor with the file’s contents looking similar to this:
With the wp-config.php file now open in a text editor, look for WP_MEMORY_LIMIT. It will often be wrapped in parentheses with the word ‘define’ e.g. define( 'WP_MEMORY_LIMIT', '32M' );
Once found, you will need to increase the number as required. For example, you may wish to increase your memory limit to 64MB by changing ‘32M’ to ‘64M’, or to 256MB by replacing ‘32M’ with ‘256M’.
If you aren’t able to find any reference to WP_MEMORY_LIMIT in the file, this is not an immediate problem. You can just type it in as shown here above the line containing “That's all, stop editing! Happy publishing.” See the example below:
Once you are done with the above, save the updates you have made, and re-upload your wp-config. php file to your server via FTP. You will be asked if you wish to replace or overwrite the existing wp-config. php file, to which you should say “Yes”:
Now, try refreshing your website or carrying out the operation again that initially caused the “Allocated memory size exhausted” error to display to check if the issue is fixed.
2: Editing the php.ini file
If increasing the Wordpress memory limit by editing the wp-config.php file didn’t help solve your issue, the next step is to change your server settings via the php.ini file. All Wordpress sites run using PHP, so by modifying the php.ini file, we are able to change the PHP configuration for the server that powers your website.
The easiest way of doing this is via your web hosting providers control panel. Login to your account and look for ‘cPanel’ - once logged in, it should look similar to the below:












