Need help? Chat now!

Hostwinds Tutorials

Search results for:


Table of Contents


How Do I Fix Out of Memory Errors on WordPress?
How Do I Increase Memory Using the php.ini File?

What Causes WordPress Out of Memory Errors

Tags: WordPress 

How Do I Fix Out of Memory Errors on WordPress?
How Do I Increase Memory Using the php.ini File?

Out-of-memory errors in WordPress are one of the most common errors that can occur with sites running on WordPress. WordPress themes and plugins are notorious for hogging up site resources and bogging down your site, especially if you have many of them. Un-optimized code can also be too demanding and easily start to eat up what memory you have available.

How Do I Fix Out of Memory Errors on WordPress?

You may be able to increase the memory available for your site by simply adding a single line of code to your wp-config.php file. To do this, follow these steps:

Step One: Go to the File Manager in your cPanel Interface.

Step Two: Find the wp-config.php file located with your WordPress installation and choose edit.

Step Three: Add the following line at the end just before the "Happy Blogging" line:

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

If this line already exists, increase the number to a higher value than what it was previously.

If on a Shared or Business hosting plan, this value will have a cap. The Shared hosting maximum PHP memory limit can be found here, and the Business hosting maximum PHP memory limit can be found here. If on a VPS, there would be no Hostwinds set limit.

This may or may not help, depending on what memory is available according to your php.ini file and the memory allowed per the hosting plan. It has the final say and can overwrite the above change. However, if your wp-config.php file didn't have that line or had a lower amount than what the php.ini has, this will have a good probability of fixing it.

If it doesn't fix it, then you can change the amount of memory allocated to the site in the php.ini file if you're on a Cloud or dedicated server (below). If you're on one of our shared hosting plans, you don't have access to the php.ini file. Try the other fixes below, and if nothing works, it may be time to upgrade your hosting plan.

How Do I Increase Memory Using the php.ini File?

Cloud VPS and Dedicated hosting plan users can edit the php.ini file for the site. It's typically found in the root of the directory if there is one. If not, you can create one.

Step One: Download or create the php.ini file in Notepad or your preferred text editor

Step Two: Add this line:

memory_limit=256M

Step Three: Upload it to the root directory of your site.

Step Four: Check to see if the problem is fixed

If this doesn't correct the problem, you can increase the memory limit referenced above by replacing the memory limit in the above example with a value of your choosing.

Cleaning up your WordPress installation

This should be done now and then regardless of whether you're getting errors or not. Doing these can improve the overall performance of your WordPress installation and reduce resource consumption.

  • Get rid of any plugins that you don't need. Delete them – don't just deactivate them and let them pile up in your plugin directory.
  • Empty the trash section and get rid of the revised versions of posts
  • Delete all those spam comments that have been piling up since you first started your site
  • A useful plugin that can be used to profile the Resource Consumption of other plugins is the P3 Prothe filer installed on your WordPress.

If you should have any questions or would like assistance, please contact us through Live Chat or by submitting a ticket with our Technical Support team.

Written by Michael Brower  /  December 12, 2016