New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

Configuration

Learn how to increase the WordPress PHP memory limit.

Memory exhausted fatals appear during large imports, plugin updates, and page builder saves. WordPress can request more PHP memory through wp-config.php and server settings.

Time: 15-25 minutes Level: Beginner
Neil McNaught, founder of BugShield and WordPress author
Written by
Written by
Updated
Updated

What this problem looks like

WordPress default memory is often 40M, which is tight for WooCommerce and builders. WP_MEMORY_LIMIT asks PHP for more per request.

Raising memory treats the symptom. Bloated plugins or runaway queries still need investigation on busy sites.

Step 1: Set memory in wp-config.php

Open wp-config.php in your site root, next to wp-admin and wp-content. Search for WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT first. If those lines already exist, update them instead of adding duplicates. If neither exists, paste the constants above the line that says stop editing:

php
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

Step 2: Change PHP memory_limit in hosting

cPanel MultiPHP INI Editor and Plesk PHP settings control the server ceiling. WordPress cannot exceed memory_limit in php.ini.

  • Set memory_limit to 256M or 512M for builder sites.
  • Restart PHP-FPM if the host requires it after INI changes.

Step 3: Verify current limits on SSH

Only run these commands if you have SSH access to the server.

bash
wp eval 'echo WP_MEMORY_LIMIT . "\n";'
php -i | grep memory_limit

Step 4: When raising memory does not help

Infinite loops and broken queries still exhaust any limit. Enable WP_DEBUG_LOG in wp-config.php and profile heavy plugins. Search for existing WP_DEBUG lines first and update them instead of adding duplicates.

Rename wp-content/plugins to plugins.disabled via File Manager, SFTP, or FTP to isolate a plugin that leaks memory.

Step 5: WooCommerce and import guidance

Product CSV imports and translation plugins often need 512M temporarily. Lower limits after the job completes if the host prefers it.

When to stop DIY and hire help

Chronic memory errors on production shops need code-level fixes, not only INI tweaks. BugShield diagnoses memory and performance issues at a confirmed fixed price.

Questions answered

WordPress PHP memory limit FAQs

Answers about WordPress and server limits, safe values, hosting restrictions, error logs, and resource-heavy plugins.

What is a good memory limit for WordPress?

128M to 256M suits most brochure sites. WooCommerce and builders often need 256M to 512M for admin tasks.

Can I set memory in .htaccess?

On some Apache hosts php_value memory_limit works. PHP-FPM nginx stacks use php.ini instead.

Will this speed up my site?

Higher memory prevents fatals but does not replace caching and lean plugins for speed.

Why does admin need more memory than the front end?

Dashboard loads every plugin admin module at once. WP_MAX_MEMORY_LIMIT targets that heavier footprint.

What is the difference between WordPress memory and PHP memory?

WordPress requests memory with its constants, while PHP enforces the server limit. WordPress cannot raise itself beyond the maximum allowed by the host.

Where should I increase the WordPress PHP memory limit?

Start with your host's PHP settings, then set appropriate WordPress limits in wp-config.php. The available method depends on the server configuration.

Is 256MB enough memory for WordPress?

It is a common working limit for many sites, but WooCommerce, imports, page builders, backups, and large admin tasks may need more or need optimisation.

Why does WordPress Site Health show a lower memory limit?

The host may override local settings, the WordPress constant may be misplaced, or separate web and command-line PHP configurations may use different values.

Should I check error logs before increasing WordPress memory?

Yes. Confirm an allowed-memory error and note the failing file and request. A larger limit should not replace investigation of a plugin consuming memory abnormally.

How do I verify the new WordPress memory limit?

Check Site Health or a trusted server-information screen, repeat the original task, and confirm the PHP error log no longer reports exhaustion.

Would you rather a developer fixed it?

Request a fix at a confirmed price and speak directly with the BugShield developer working on your site.

Request a Fix