WordPress Memory Limit: WordPress vs PHP for Managing Website Memory Limits
Set PHP memory first, then tune WordPress. PHP is the building’s main power switch. WordPress is the room dimmer. If PHP says “128 MB max,” WordPress cannot magically use 512 MB, no matter how nicely you ask in wp-config.php.
TLDR: The PHP memory limit is the real ceiling. The WordPress memory limit tells WordPress how much memory it should request for normal work and admin work. For example, a WooCommerce store with 40 plugins may hit fatal errors at 128 MB, but run smoothly at 256 MB or 512 MB. In one common support case, raising PHP from 128 MB to 256 MB cut checkout crashes from 9 per week to zero.
WordPress memory limit vs PHP memory limit
Think of your site like a hungry little robot.
WordPress is the robot’s brain. PHP is the kitchen that feeds it. Plugins, themes, page builders, image tools, backups, and ecommerce features all ask for snacks.
Sometimes they ask for too many snacks.
Then you see the dreaded message:
Fatal error: Allowed memory size of 134217728 bytes exhausted.
That number is not random. It means PHP gave your site 128 MB of memory. Your site tried to use more. PHP slammed the door.
Image not found in postmetaWhat is the PHP memory limit?
The PHP memory limit is the maximum memory one PHP process can use.
WordPress runs on PHP. So every page load, admin screen, plugin task, import, export, and checkout request must fit inside that PHP limit.
You may see it written like this:
memory_limit = 128Mmemory_limit = 256Mmemory_limit = 512M
This setting can live in several places:
php.ini.user.ini.htaccesson some Apache servers- Your hosting control panel
- Your server stack settings
If you use managed hosting, you may not touch these files at all. You may need a toggle in the hosting panel. Or a support ticket. Yes, expect to waste time hunting the “real” setting if your host hides it behind three menus.
What is the WordPress memory limit?
The WordPress memory limit is WordPress saying, “I would like this much memory, please.”
You usually set it in wp-config.php.
For normal site pages, people often add:
define('WP_MEMORY_LIMIT', '256M');
For admin tasks, you may also see:
define('WP_MAX_MEMORY_LIMIT', '512M');
These constants help WordPress handle bigger jobs. Think plugin updates, image edits, imports, reports, and store orders.
But here is the grumpy bit.
WordPress cannot beat PHP.
If PHP is capped at 128 MB, setting WordPress to 512 MB may do nothing. It is like putting a “300 mph” sticker on a bicycle.
Which one wins?
The lower effective limit usually wins.
Here is the simple version:
- If PHP allows 512 MB and WordPress asks for 256 MB, WordPress can use about 256 MB.
- If PHP allows 128 MB and WordPress asks for 256 MB, PHP may stop it at 128 MB.
- If PHP allows 256 MB and WordPress admin asks for 512 MB, admin tasks may still hit 256 MB.
So the best order is:
- Check the current PHP limit.
- Raise it at the server or hosting level.
- Set WordPress limits to match your site’s needs.
- Test the task that was failing.
How much memory does your site need?
There is no perfect number for every site.
A small blog may be fine at 128 MB. A business site with a page builder may prefer 256 MB. A WooCommerce store with subscriptions, filters, coupons, and reports may need 512 MB.
Use this as a friendly starting point:
- 128 MB: Small blog, light theme, few plugins.
- 256 MB: Most business sites, page builders, common plugins.
- 512 MB: WooCommerce, learning sites, memberships, large imports.
- 768 MB or more: Heavy admin jobs, huge catalogs, complex reports.
Do not just crank it to the moon. More memory does not fix bad code. It only gives bad code a larger lunch box.
How to check your current memory limit
The easiest place is WordPress Site Health.
- Go to Tools.
- Click Site Health.
- Open the Info tab.
- Check the Server section.
- Look for PHP memory limit.
You can also check WooCommerce status if you run a shop.
- Go to WooCommerce.
- Click Status.
- Look for memory details.
If the values do not match what you set, do not panic. This is common. It drives me crazy that one screen may say 256 MB while another still shows 128 MB until PHP reloads or the correct config file is changed.
How to raise the WordPress memory limit
Open wp-config.php. Add the lines above the text that says:
/* That's all, stop editing! Happy publishing. */
Add this:
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
Save the file. Clear cache. Test again.
If the error remains, PHP is probably still blocking you. Or a plugin is eating memory like a raccoon in a pizza shop.
How to raise the PHP memory limit
This depends on your hosting.
Common methods include:
- Change
memory_limitinphp.ini. - Add
memory_limit = 256Mto.user.ini. - Use a hosting panel PHP settings screen.
- Ask your host to raise it.
- Restart PHP or the server if you manage it yourself.
On some hosts, changes take a few minutes. On others, they need a PHP service restart. Shared hosting can be extra picky.
When more memory is not the real fix
Memory errors can be symptoms.
Raising the limit may stop the crash. Great. But the cause may still be ugly.
Watch for these troublemakers:
- A bloated page builder layout.
- A backup plugin running during peak traffic.
- A security scanner checking huge folders.
- A product import with thousands of rows.
- A plugin conflict after an update.
- Huge images being resized on upload.
If your site needs 1 GB just to load the homepage, something is wrong. Start turning off non-critical plugins on a staging site. Check error logs. Test slow admin pages. Look for one plugin causing a sudden jump.
A simple real-world case
Imagine a store called Bean Rocket Coffee.
It has 1,800 products. It runs WooCommerce, a shipping plugin, a coupon plugin, a page builder, and a reporting plugin. The PHP memory limit is 128 MB. The owner tries to export monthly orders.
Boom. White screen.
The host raises PHP memory to 512 MB. WordPress gets:
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
The export now finishes in 42 seconds. Before, it failed after about 18 seconds. The store also sees fewer checkout timeouts during busy hours.
The best setup for most sites
For a normal WordPress site, try this:
- PHP memory limit: 256 MB
- WordPress memory limit: 256 MB
- WordPress admin max memory: 512 MB
For WooCommerce or membership sites, consider:
- PHP memory limit: 512 MB
- WordPress memory limit: 256 MB
- WordPress admin max memory: 512 MB
The key idea is simple. PHP sets the ceiling. WordPress works inside it. If your site keeps crashing, raise the PHP limit first. Then set WordPress limits with care. After that, hunt the plugin or task that caused the mess.