Laptop on wooden desk displaying PHP code for WordPress memory limit in wp-config file

How to Increase WordPress Memory Limit (2026 Guide)

I was live-demoing a new WooCommerce store to a client when the checkout page crashed with “Allowed memory size of 128 megabytes exhausted.” The client watched silently as I frantically edited wp-config.php via my phone’s FTP app. Three minutes of pure embarrassment could have been avoided with proper memory allocation.

WordPress memory errors, specifically the dreaded “Allowed memory size of X bytes exhausted” message, are among the most common and disruptive issues administrators encounter. This isn’t merely an inconvenience, it halts script execution and renders your site inaccessible or functionally impaired. When WordPress, a plugin, or a theme attempts to consume more PHP memory than the server currently permits, this critical error appears. Understanding how to increase WordPress memory limit and applying the correct solution is fundamental for reliable site operation. This guide builds on our WordPress Basics and Installation foundation to help you resolve memory exhaustion errors.

Understanding the WordPress Memory Exhaustion Error

Flat vector illustration of WordPress memory exhaustion error concept with overflowing memory gauge and developer
Visual explanation of the WordPress memory exhaustion error showing a full memory limit being exceeded during PHP script execution in a simple beginner-friendly diagram

Every application running on a server requires a certain amount of system resources.

PHP, the scripting language WordPress is built on, operates within predefined limits. One such limit is memory_limit. This directive dictates the maximum amount of RAM a PHP script can consume.

Why WordPress Requires Memory

WordPress, by its very nature, is dynamic.

It processes requests, interacts with databases, loads themes, and executes numerous plugins. Each of these operations demands memory. Complex themes often require more resources. E-commerce platforms, like WooCommerce, significantly increase memory usage due to product data, user sessions, and payment gateways.

Image manipulation, large data imports, or running extensive security scans can push the system beyond its configured threshold. When the allocated memory is insufficient, the script crashes. You see that error message, and your site goes down.

How Much Memory Does WordPress Need in 2026?

There isn’t a universal answer for all WordPress sites.

A basic WordPress installation might run comfortably on 64MB or 128MB. However, this rapidly changes with added functionality. Most hosting providers, and WordPress itself, recommend higher baselines.

As of 2026, a production WordPress site running a modern theme and a moderate set of plugins should ideally have a minimum of 256MB PHP memory.

Sites with WooCommerce, page builders, or many concurrent users often demand 512MB or even 1GB. Exceeding the limit isn’t just about functionality, it impacts user experience directly.

Slower page loads, failed operations, and outright inaccessible pages frustrate visitors. Data confirms a direct correlation between site speed and user retention, plus SEO rankings.

Checking Your Current WordPress Memory Limit

Before making any changes, confirm your current memory limit.

This is straightforward using two primary methods:

Method 1: WordPress Site Health Tool

Navigate to “Tools,” “Site Health” in your WordPress admin dashboard.

Click on the “Info” tab, then expand the “Server” section. You’ll find the “PHP memory limit” listed there. This is your most convenient option.

Method 2: phpinfo() File

For a comprehensive server overview, create a file named phpinfo.php in your site’s root directory with the content <?php phpinfo(); ?>.

Access this file via your browser (e.g., yourdomain.com/phpinfo.php). Search for memory_limit.

Crucially, delete this file immediately after checking. It exposes sensitive server configurations, posing a significant security risk.

Essential Pre-Modification Protocols

Modifying server configuration files carries inherent risks.

Always, without exception, execute a full backup of your WordPress installation (files and database) before proceeding. This is non-negotiable because a misstep can render your site non-functional.

Follow our comprehensive guide on How to Backup Your WordPress Website before making changes.

Important Considerations

Consider these points before proceeding:

  • Server Environment: On shared hosting, your ability to alter php.ini or override directives via .htaccess might be restricted
  • Incremental Changes: Don’t jump from 64MB to 1GB immediately (increase the limit gradually, start with 256MB, then 512MB)

Method 1: Editing wp-config.php to Increase Memory Limit

Flat vector illustration of a beginner editing WordPress wp-config.php file to increase PHP memory limit on a server dashboard
Beginner-friendly illustration showing how editing the wp-config.php file can help increase the WordPress PHP memory limit and resolve memory exhaustion errors.

This is the most common and often successful method for WordPress installations.

The wp-config.php file is a core WordPress configuration file.

Step-by-Step Instructions

Follow these steps carefully:

  1. Connect to your server using an FTP client (like FileZilla) or your hosting provider’s file manager
  2. Locate the wp-config.php file in your WordPress root directory (same directory containing wp-admin and wp-includes folders)
  3. Download the file to your local machine as a backup
  4. Open the wp-config.php file with a plain text editor (Notepad++, VS Code)
  5. Look for the line that says: /* That's all, stop editing! Happy publishing. */
  6. Above this line, add the following code:
define( 'WP_MEMORY_LIMIT', '256M' );

If you have a very large site, or a demanding setup (WooCommerce with many products), you might need '512M' or '1G'. Start lower.

Save the file and upload the modified wp-config.php file back to your server, overwriting the original.

Understanding WP_MAX_MEMORY_LIMIT

WordPress also defines WP_MAX_MEMORY_LIMIT.

This is typically used for the administration backend and is usually set to a higher value than WP_MEMORY_LIMIT for tasks like image editing. Setting WP_MEMORY_LIMIT often dictates both unless explicitly overridden.

Method 2: Editing php.ini to Increase Memory Limit

Flat vector illustration of a beginner developer editing php.ini settings to increase PHP memory limit on a web server
Professional vector illustration showing how editing the php.ini configuration file can increase the PHP memory limit for WordPress websites.

This method modifies the PHP configuration directly.

It impacts all PHP scripts on your server or within that specific PHP environment. This is often only possible on VPS or dedicated servers, or if your shared host provides a custom php.ini option.

Step-by-Step Instructions

  1. Locate your php.ini file (location varies significantly by hosting environment)
  2. Common paths include /etc/php/X.X/fpm/php.ini or /opt/alt/phpX/etc/php.ini (where X.X is your PHP version)
  3. You might also find it in your user’s home directory (public_html/php.ini) on some shared hosts
  4. If unsure, contact your host
  5. Open the php.ini file with a text editor
  6. Search for the directive: memory_limit =
  7. Change the value to your desired limit:
memory_limit = 256M

Use M for megabytes or G for gigabytes.

Save the file and restart your web server (Apache/Nginx) and PHP-FPM service. This is critical for changes to take effect. If you don’t have access, your host must do this.

Important Note About Configuration Hierarchy

A setting in wp-config.php can override a lower memory_limit in php.ini.

The highest setting generally takes precedence, but it depends on server configuration.

Method 3: Editing .htaccess to Increase Memory Limit

Flat vector illustration showing cartoon developer editing .htaccess file via FTP to increase WordPress memory limit.
Visual workflow for editing the .htaccess file on your server, an alternative method for raising PHP memory limits in WordPress.

The .htaccess file is a server configuration file, primarily for Apache web servers.

It allows you to override certain server settings on a per-directory basis. This method is less reliable than wp-config.php or php.ini and may not work on all hosting environments, especially those using Nginx.

Step-by-Step Instructions

  1. Connect to your server via FTP or file manager
  2. Locate the .htaccess file in your WordPress root directory (it might be hidden, so ensure your FTP client or file manager shows hidden files)
  3. Download the file as a backup
  4. Open the .htaccess file with a text editor
  5. Add the following line to the end of the file:
php_value memory_limit 256M

Save the file and upload it back to your server.

Important Warning

If this method causes a “500 Internal Server Error”, immediately revert the change by restoring your backup .htaccess file.

Your server setup does not permit this directive. Review our guide on How to Fix the 500 Internal Server Error if needed.

Method 4: Contacting Your WordPress Hosting Provider

Flat vector illustration of cartoon developer contacting WordPress hosting support for memory limit increase.
Friendly visual guide showing the process of reaching out to your hosting provider when other methods to fix WordPress memory exhaustion don’t work.

When in doubt, or if previous methods fail, contact your hosting provider’s support.

This is often the safest and most effective solution, especially on shared hosting where direct server modifications are restricted.

What to Communicate

Provide this information clearly:

  • State the exact error message (“Allowed memory size…”)
  • Mention that you’ve attempted basic troubleshooting (checking Site Health)
  • Politely request an increase to your PHP memory_limit (e.g., to 256MB or 512MB)

Your host can verify server-wide limits and make the necessary adjustments on your behalf.

Review our guide on How to Choose the Best WordPress Hosting for providers that offer better resource allocation.

Based on current industry standards and the demands of contemporary WordPress ecosystems (2026), these are generally accepted memory thresholds:

Memory Limit Typical Use Case Notes
128MB Minimal Blog/Brochure Site Bare minimum for basic WordPress. Likely to encounter issues with complex themes or multiple plugins.
256MB Standard Blog/Business Site Good starting point. Handles most themes and a reasonable number of plugins.
512MB E-commerce (WooCommerce), Page Builders, Large Content Sites Highly recommended for resource-intensive sites. Necessary for smooth operation and simultaneous processes.
1GB+ Enterprise-level, Highly Trafficked, Complex Integrations For very large sites, extensive custom code, many active users, or multiple large plugins. Requires robust server resources.

These figures reflect actual PHP process consumption observed on typical hosting environments. Reputable hosts often offer plans with 512MB or more as standard.

Post-Modification Troubleshooting

After increasing the memory limit, recheck your WordPress Site Health tool.

Confirm the PHP memory limit reflects the new value. Clear any site caching (plugins, CDN, server-side) to ensure you’re seeing the latest configuration.

If the Error Persists

If the error persists despite increasing memory, the problem might not be purely a memory limit issue.

Consider these factors:

  • Plugin Conflicts: A specific plugin might be extremely inefficient or have a bug (temporarily deactivate plugins to isolate the culprit)
  • Theme Issues: Your theme might be poorly coded or excessively heavy
  • Server Resources: If you’re on shared hosting, the server itself might be constrained (CPU, I/O)
  • Database Load: Inefficient database queries can consume excessive memory and CPU (requires WordPress database optimization)
  • Security Concerns: A compromised site running malicious scripts can consume abnormal resources

Sometimes, errors related to installing plugins can reveal underlying memory issues if the system struggles during the upload process.

A thorough WordPress malware removal can help diagnose and resolve security-related resource consumption.

Frequently Asked Questions About WordPress Memory Limit

What does “Allowed memory size exhausted” mean in WordPress?

This error means a PHP script tried to use more memory than the server allows. WordPress, a plugin, or theme exceeded the memory_limit setting in PHP configuration, causing the script to crash.

Which method is best for increasing WordPress memory limit?

Editing wp-config.php is best for most users because it’s WordPress-specific, easy to implement, and works on most hosting environments. It doesn’t require server restarts or special permissions.

Can increasing memory limit slow down my site?

No, increasing the memory limit doesn’t slow your site. It provides more resources for scripts to run properly. However, if you need massive memory limits (1GB+), it indicates inefficient code that you should optimize.

How do I know if my memory increase worked?

Check Tools, Site Health, Info tab, Server section in WordPress admin. The PHP memory limit should show your new value. You can also verify that the error no longer appears.

What if my hosting provider won’t increase memory limit?

Consider upgrading your hosting plan or switching to a provider that offers adequate resources. Quality hosts typically provide at least 256MB for standard plans and 512MB+ for business/e-commerce plans.

Is 256MB enough for WooCommerce?

256MB might work for small WooCommerce stores with few products. However, 512MB is strongly recommended for WooCommerce sites to handle product catalogs, customer sessions, checkout processes, and payment gateway integrations smoothly.

Additional Resources for WordPress Performance

Continue building your WordPress optimization expertise with these essential guides:

Resolving the “Allowed memory size exhausted” error is a common administrative task for WordPress professionals. The methods outlined here (primarily wp-config.php and php.ini) directly address the PHP memory limit, allowing your site scripts the resources they need. Always prioritize backups, always increase limits incrementally, and when in doubt, consult your hosting provider. Ensuring your WordPress installation has sufficient memory isn’t just about error prevention, it’s about maintaining a stable, performant, and secure platform. Return to WordPress Basics and Installation whenever you need to review the foundational concepts that make professional WordPress site management possible.

Author

  • Alex Siteguard, WordPress Educator and Performance Specialist at CreatePressHub.

    Alex Siteguard is a WordPress educator and website optimization specialist from Canada, known for turning complex WordPress concepts into clear, beginner-friendly tutorials. He graduated from the University of British Columbia with a degree in Web Technologies, where he developed a strong foundation in web development, UX design, and digital security.

    With years of hands-on experience building and securing WordPress sites, Alex focuses on helping users understand the core of WordPress from setup and customization to performance, security, and advanced features. His teaching style is practical and straightforward, empowering bloggers, business owners, and aspiring developers to create reliable, fast, and beautifully designed websites.

    When he’s not creating new tutorials, Alex enjoys testing the latest WordPress plugins, refining site security techniques, and supporting the community through forums, workshops, and online learning groups.

    Languages: English.

Our Newsletter

Get awesome content delivered straight to your inbox.

Related Articles

The Ultimate

WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Leave a Comment

white background featuring a white icon, representing the WordPress Toolkit guide.