Raise the PHP memory limit first, then set the WordPress memory limit to match your site’s needs. PHP is the ceiling. WordPress is the room inside that ceiling. WordPress often uses 40 MB as its default memory limit for single sites, and 64 MB for multisite installs [source: WordPress].
TLDR: If WordPress says it needs more memory, start with PHP. Then adjust WordPress using WP_MEMORY_LIMIT. For example, a WooCommerce shop with 35 plugins may crash at 128 MB, but run fine at 256 MB. One small store I saw went from random checkout errors to stable orders after memory was raised from 128 MB to 256 MB.
WordPress memory vs PHP memory
Think of PHP memory as the size of the lunchbox.
Think of WordPress memory as the sandwich asking for space inside it.
If the lunchbox is tiny, the sandwich gets crushed. Sad sandwich. Sad site.
PHP memory limit is set by your server. It controls how much memory a PHP script can use. WordPress runs on PHP, so WordPress must obey this limit.
WordPress memory limit is set inside WordPress. It tells WordPress how much memory it should try to use. But it cannot magically break the server limit.
That part trips people up. It drives me crazy that many guides say “just edit wp-config.php” like the server will politely step aside. Sometimes it will. Often it will not.
The simple rule
- PHP memory limit is the hard limit.
- WordPress memory limit is the WordPress request.
- The lower limit usually wins.
So if PHP allows 128 MB, setting WordPress to 512 MB may do nothing. The server may still stop the process at 128 MB.
If PHP allows 512 MB, setting WordPress to 256 MB gives WordPress 256 MB to work with. That is usually plenty for many normal sites.
What happens when memory runs out?
You may see a scary message like this:
Fatal error: Allowed memory size of 134217728 bytes exhausted
That number means the site hit its memory cap. In this example, 134217728 bytes is about 128 MB.
You may also see:
- A blank white screen.
- A 500 error.
- A slow admin area.
- Failed plugin updates.
- WooCommerce checkout errors.
- Page builder crashes.
Honestly, it feels like the site is being dramatic. But it is not. It is just out of working space.
Why WordPress needs more memory
WordPress itself is not usually the monster.
The heavy stuff is often added later.
- Big themes with many features.
- Page builders.
- WooCommerce.
- Membership plugins.
- Backup plugins.
- Security scanners.
- Import tools.
- Huge image libraries.
Each plugin asks PHP for memory. Some ask nicely. Some barge in wearing muddy boots.
A basic blog may be fine at 128 MB. A larger WooCommerce site may need 256 MB or 512 MB. A messy site with many plugins may still struggle even after a memory bump.
How to check your current memory limit
The easiest way is inside WordPress.
- Go to Tools.
- Click Site Health.
- Open the Info tab.
- Check the Server section.
You can often see the PHP memory limit there. Some hosting dashboards show it too.
You can also ask your host. Use plain words. Say: “What is my PHP memory_limit, and can you raise it to 256M?”
That saves time. No wizard hat required.
How to increase WordPress memory
You can add this line to your wp-config.php file:
define( 'WP_MEMORY_LIMIT', '256M' );
Place it above this line:
/* That's all, stop editing! Happy publishing. */
This tells WordPress to try using up to 256 MB.
You can also set a higher admin memory limit:
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
This is useful because admin tasks can be heavier. Updates, imports, backups, and image work can be chunky little beasts.
How to increase PHP memory
This depends on your hosting setup.
On some hosts, you can change it in the control panel. Look for terms like:
- PHP Settings
- MultiPHP INI Editor
- PHP Options
- memory_limit
You may set it like this:
memory_limit = 256M
Some servers allow changes in .htaccess:
php_value memory_limit 256M
But be careful. On many modern servers, that line can break the site. One wrong rule and boom. White screen. Classic Monday behavior.
If you use managed hosting, you may not be allowed to change PHP memory yourself. In that case, contact support. Ask for 256M first. If you run WooCommerce or a giant builder site, ask if 512M is allowed.
Which one should you change first?
Change PHP first, or at least check it first.
Here is the clean order:
- Check PHP memory_limit.
- Raise PHP to 256M if needed.
- Set WordPress memory to 256M.
- Set admin max memory to 512M if your site is heavy.
- Test the site.
This order avoids the silly situation where WordPress asks for 512 MB while PHP is stuck at 128 MB.
What number should you use?
Use enough memory. Do not go wild for no reason.
| Site type | Suggested memory |
|---|---|
| Small blog | 128M |
| Business site | 256M |
| WooCommerce shop | 256M to 512M |
| Large membership site | 512M or more |
More memory can stop crashes. But it will not fix bad code. It will not repair a bloated plugin. It will not make cheap hosting act like a sports car.
Memory is not speed
This part matters.
Increasing memory gives WordPress more breathing room. It does not always make pages load faster.
If your site is slow, you may also need:
- Better caching.
- Smaller images.
- Fewer plugins.
- A cleaner theme.
- A better database.
- Stronger hosting.
Expect to waste time on this if you only chase memory. A site can have 512 MB and still crawl if it loads twelve sliders, six fonts, and a plugin that thinks every page view is a tax audit.
When increasing memory is the wrong fix
Sometimes memory errors are a symptom.
Watch for these signs:
- The error started after installing one plugin.
- The site crashes only during backups.
- The admin area dies when opening one page.
- Memory use keeps rising for no clear reason.
In those cases, disable the newest plugin first. Switch to a default theme for a quick test. Check error logs. Ask your host for the exact process that is hitting the limit.
If one plugin eats 300 MB by itself, giving it more memory may only delay the next crash.
The best setup for most sites
For a normal WordPress site, use this setup:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
Then make sure PHP allows at least 256M. If the site runs WooCommerce, large imports, or heavy admin jobs, ask your host about 512M.
Keep it simple. PHP sets the ceiling. WordPress asks for space under that ceiling. If both numbers make sense, your site gets room to work without throwing a tiny digital tantrum.
Final takeaway: Do not only edit WordPress and hope. Check PHP too. Match both limits, test the site, and then hunt down any plugin that still acts like it owns the whole server.