How to Increase PHP Memory Limit

In this article, you'll learn how to increase the PHP memory limit in both your WordPress install and your hosting settings.

  1. Increasing the PHP memory limit using WordPress
  2. Increasing the PHP memory limit using the hosting server settings
  3. Summary

Having problems loading a page using Cornerstone or Pro Content Builder? The kind of error where you are either stuck with the loading icon or getting a popup error saying there's an error in loading.

There are many possible reasons why this happens. It could be any (but not limited to) of the following:

  • Caching issue
  • A page redirection is set up
  • Third-party plugin conflict
  • Slow server
  • To many un-optimized images on the page

But there's another reason: if it's the culprit, can easily be solved. I'm talking about "exhausted" memory.

WordPress, our beloved CMS, is built using the PHP programming language. Website hosting providers put a limit to the amount of memory PHP can use at a given operation. If an operation reaches the memory limit set, it will return an error.

When editing with either Cornerstone or the Content Builder and PHP has reached its memory limit, then you'll get an loading error. So what's the solution to this? You might have already guessed it from the title of this article - it's increasing PHP memory limit.

You can increase the PHP memory limit in either WordPress or your hosting server's settings. Take note, though, that you can only increase memory using WordPress up to whatever the server limits it to. So if your server's memory limit is only 512MB, if you set 1024MB on WordPress, it cannot exceed it.

Increasing the PHP memory limit using WordPress

You can easily increase the PHP memory limit in WordPress. If you only have access to FTP - as in some cases where web developers aren't given access to the hosting's settings - simply edit the wp-config.php file found on your WordPress install's root folder.

To do that, open up your favorite FTP Client Software (e.g. Filezilla), go to the WordPress install's root folder, look for wp-config.php, right-click, the select "View / Edit."

Edit FTP File

It will open the file in your text editor.

Add this code before the /* That's all, stop editing! Happy blogging. */ section:

define('WP_MEMORY_LIMIT', '512M');
Edit Memory Limit

512M means 512 megabytes. That is our recommended memory limit for X and Pro.

Increasing the PHP memory limit using the hosting server settings

In some hosting providers, they would allow you to increase your memory limit through a settings panel. If you're unsure whether you have this ability, you might want to contact your provider and ask them whether you have that ability and if they say no, ask them if they can increase it for you.

If your server gives you the ability to increase memory on your own, you need to access the php.ini file and edit/add the line below:

memory_limit = 512M;

If you don't have access to the php.ini file you can increase the limit using the .htaccess file in the root folder of your WordPress installation:

php_value memory_limit 512M

Summary

Now you know how to increase the PHP memory limit of your WordPress websites. If you experiencing the loading error in either Cornerstone or Pro Content Builder, increasing the memory limit is one of the most straightforward step you can take. An "exhausted" memory is one of the possible reasons why you are getting this error and increasing the memory limit using the methods we showed above could be the easiest way to solve the problem.

See something inaccurate? Let us know