WordPress

How to Increase the PHP Memory Limit in WordPress

If you use WordPress, you may have come across the annoying “memory exhausted” error message at some point.

…you know exactly how frustrating (and scary) it can be. Your site might go completely white, the admin dashboard freezes, plugins refuse to install or update, or media uploads fail mid-process. This “memory exhausted” error is one of the most common WordPress issues, especially on sites running modern page builders (Elementor, Divi, Bricks), WooCommerce stores, heavy caching plugins, or dozens of extensions.

When your PHP script needs more memory than is currently assigned to it, this error occurs. Fortunately, this problem can be fixed by increasing WordPress’s PHP memory limit.

In this tutorial, we will explain how to increase the PHP memory limit in WordPress to ensure your website runs uninterrupted.

What Is the PHP Memory Limit (and Why Does WordPress Care)?

PHP memory limit (memory_limit in PHP configuration) is the maximum amount of RAM a single PHP script can consume before PHP kills the process to protect the server. WordPress runs entirely on PHP, so every page load, admin action, plugin activation, or image resize counts toward this limit.

Why Increase the PHP Memory Limit in WordPress?

It is necessary to increase the PHP memory limit in WordPress for a few key reasons. Here’s why you should consider boosting your PHP memory:

1. Improved Performance: By increasing the PHP memory limit, you provide more resources for your WordPress website to operate efficiently. This is especially important if you have resource-intensive themes, plugins, or custom code that require additional memory to function properly.

2. Avoiding Memory Exhaustion Errors: If your website exceeds the default PHP memory limit, you may encounter “memory exhausted” or “fatal error: allowed memory size” messages. These errors can cause your site to crash or become unresponsive. Increasing the PHP memory limit helps prevent these issues and ensures smooth operation.

3. Handling Large Files and Processes: If you often work with large files, run complex queries, or execute data-intensive operations on your WordPress site (e.g., importing/exporting data), having sufficient PHP memory is crucial. Insufficient memory can lead to incomplete tasks or even the corruption of data.

4. Compatibility with Resource-Intensive Plugins and Themes: Certain plugins and themes function optimally with higher amounts of PHP memory. If you’re using such resource-intensive tools on your WordPress site, it’s essential to increase the memory limit to ensure their proper functioning.

You may like: How to Improve Crawlability and Indexability of Your Website

The following are some of the ways in which you can increase the PHP memory limit in WordPress-based websites.

Method 1: Increase via wp-config.php (Easiest & Most Recommended)

This method tells WordPress to request more memory without touching server files. It works on ~80% of hosts.

  1. Access your site’s files via File Manager (cPanel), FTP (FileZilla), or SSH.
  2. Locate wp-config.php in the root directory (same folder as wp-content, wp-admin).
  3. Download a backup copy first!
  4. Open in a text editor and add one or both of these lines just before the line that says /* That’s all, stop editing! Happy publishing. */:
define( 'WP_MEMORY_LIMIT', '256M' ); // Frontend & most operations
define( 'WP_MAX_MEMORY_LIMIT', '512M' ); // Admin area (plugins, updates, imports)

Common safe values:

  • Basic blog/portfolio: 128M / 256M
  • WooCommerce + page builder: 256M / 512M
  • Heavy membership / LMS / multisite: 512M / 1024M
  1. Save and upload.
  2. Refresh Site Health Info or your site. The error should disappear.

Method 2: Edit php.ini or .user.ini (When wp-config.php Is Ignored)

Many hosts ignore WordPress’s request if the server’s memory_limit is lower.

Via cPanel / hosting panel (easiest)

  • Log in to cPanel → MultiPHP INI Editor or Select PHP Version → Options
  • Find memory_limit
  • Set to 256M, 512M, or 1024M
  • Apply / Save

Manual php.ini / .user.ini

  1. In root folder, create or edit .user.ini (some hosts prefer this over php.ini)
  2. Add:
memory_limit = 512M

Save. Changes usually take effect in 5–30 minutes.

Method 3: Use a Plugin (No-Code Solution for Beginners)

Several free plugins make this point-and-click easy:

  • MaxLimits – Increase Maximum Upload, Post & PHP Limits (updated Nov 2025): Dashboard interface to set memory_limit, upload_max_filesize, max_execution_time, etc. Attempts runtime changes + optional .htaccess edits.
  • Memory Limit Manager (2026 plugin): One-click presets (256M/512M, 512M/1G, etc.) for WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT.

Install → activate → go to the plugin settings → choose preset or custom value → save. Clear the cache afterwards.

Caution: Plugins can fail if the host blocks ini_set(). Always verify in Site Health afterwards.

Method 4: Contact Hosting Support (When Nothing Else Works)

If you’re on shared hosting with a strict cap (e.g., 128M max), open a ticket:

“Hi, I’m getting ‘Allowed memory size exhausted’ errors. Current PHP memory limit is 128M. Can you please increase it to at least 256M (preferably 512M) for my account?”

Managed WordPress hosts (Kinsta = 256M default, WP Engine = 512M worker limit, Cloudways = adjustable) usually already have high limits or let you change them in the panel.

Conclusion

Increasing the PHP memory limit in WordPress allows you to harness the full potential of your website by ensuring optimal performance, stability, and compatibility with resource-intensive components like plugins and themes. It provides a solid foundation for managing larger files, executing complex processes efficiently, and preventing potentially disruptive errors related to insufficient memory allocation.

Have you hit the memory exhausted error recently? What was your hosting provider, and what limit worked for you? Drop a comment below—I read and reply to every one.

Show More

Raj Maurya

Raj Maurya is the founder of Digital Gyan. He is a technical content writer on Fiverr and freelancer.com. When not working, he plays Valorant.

Related Articles

Leave a Reply

Back to top button