Your site shows an error like this, either on screen or in your error log:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/.../wp-content/plugins/...
It may appear as a blank page, a “critical error” message, a failed upload, or an import that stops halfway. The cause is the same: a PHP process needed more memory than it was allowed to use, and PHP stopped it.
This guide explains what the numbers mean, how to raise the limit correctly, and how to find out whether something on your site is using far more memory than it should.
What the error means
Every time someone loads a page, PHP runs WordPress, your theme, and your plugins inside a memory budget. The number in the error is that budget in bytes. Some common values:
33554432bytes = 32 MB67108864bytes = 64 MB134217728bytes = 128 MB268435456bytes = 256 MB
The “tried to allocate” number is just the last small piece PHP asked for when it ran out. It does not tell you how much more memory you need. The file path at the end of the message is more useful: it shows which plugin or theme was running when memory ran out, although that is not always the one using the most.
Step 1: Check your current limits
Go to Tools → Site Health → Info and open the Server and WordPress Constants sections. Note three values:
- PHP memory limit (under Server): the hard ceiling set by your host.
- WP_MEMORY_LIMIT: what WordPress asks for on normal pages.
- WP_MAX_MEMORY_LIMIT: what WordPress asks for in wp-admin and heavy tasks such as image processing.
WordPress can raise its own limit up to the PHP limit, but not beyond it. If your host caps PHP at 128 MB, setting 512 MB in WordPress has no effect.
Step 2: Raise the WordPress memory limit
Open wp-config.php in File Manager or over SFTP, and add these lines above “That’s all, stop editing!”:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
For most sites, 256 MB is plenty. WooCommerce stores and sites built with page builders often need it. Reload the page that failed. If the error is gone, check Site Health again to confirm the new value is in use.
Step 3: Raise the PHP limit if WordPress cannot
If Site Health still shows the old PHP limit, raise it at the server level. Use whichever method your host supports:
- Hosting control panel: look for “PHP settings”, “Select PHP Version → Options”, or “MultiPHP INI Editor”, and set
memory_limitto256M. This is the safest method. - .user.ini or php.ini in your site’s root folder, on hosts that allow it:
memory_limit = 256M
- .htaccess, only on Apache servers running PHP as an Apache module:
php_value memory_limit 256M
Be careful with the .htaccess method. On servers that run PHP differently, this line causes a 500 Internal Server Error. If that happens, remove the line straight away. Changes to .user.ini can take a few minutes to apply. If none of these work, ask your host to raise the limit for you.
Step 4: Find what is using so much memory
Raising the limit fixes the symptom. If your site needed 128 MB last month and runs out at 256 MB today, something is wrong, and raising the limit again only delays the next crash. Look for the cause:
- Check the file path in the error. If it points to the same plugin every time, start there.
- Think about recent changes. A new plugin, an update, or a large import often lines up with the first error.
- Use Query Monitor. This free plugin shows peak memory use for each page in the admin bar. Compare pages, then deactivate suspect plugins one by one on a staging copy and watch the number.
- Look for heavy jobs. Backup plugins, broken-link checkers, related-post plugins, and sitemap or SEO tools that scan every post can use a lot of memory, especially on large sites.
Step 5: Fix common memory problems
- Huge images: uploading 6000-pixel photos straight from a camera makes WordPress create many resized copies at once, which can exhaust memory. Resize images before uploading.
- Big imports and exports: split large CSV or XML imports into smaller files, or run them with WP-CLI, which often has a higher limit.
- Bloated autoloaded options: WordPress loads every “autoloaded” setting on every page. Leftover data from deleted plugins can make this very large. Tools → Site Health warns you when autoloaded options are too big.
- Old PHP versions: current PHP versions generally use memory more efficiently. Running a PHP version your plugins support and that is still receiving security updates helps.
Step 6: If you cannot reach wp-admin
If the error takes down wp-admin as well, edit wp-config.php over SFTP or File Manager as in Step 2. If that is not enough, deactivate plugins by renaming the wp-content/plugins folder, as described in our guide to the WordPress white screen of death, then reactivate them one at a time.
When to call an expert
Get help if the error returns after you raise the limit, if your host will not go above a low limit, if the file path points to a plugin your site depends on, or if memory use keeps creeping up as your site grows. These usually mean a code or database problem that needs proper profiling, not a bigger number.
Want us to find the real cause? Our WordPress Fix service sets sensible memory limits, profiles the pages that run out, and fixes the plugin, theme, or data causing the problem. Fixed price of $49, confirmed before any work starts, with our Service Guarantee. Request a fix.
Frequently asked questions
How much memory does WordPress need?
WordPress itself has modest needs. A simple blog often runs well with 128 MB. Stores, membership sites, and sites built with page builders usually need 256 MB. If a site needs much more than that on normal pages, look for a heavy plugin or bloated data.
Is it safe to set the memory limit very high?
The limit is a ceiling, not an allocation, so a higher limit does not use more memory by itself. But a very high limit can let one broken process slow down the whole server. Raise it to what you need and fix the cause.
Why did the error start without any changes?
Automatic plugin updates, a growing database, or your host lowering limits or changing PHP versions can all trigger it. Check your update history and ask your host whether anything changed on their side.




