SimonHosting
  • Best Web Hosting
  • Reviews
  • Deals
  • Comparisons
  • Tutorials
No Result
View All Result
Best Web Hosting
SimonHosting
  • Best Web Hosting
  • Reviews
  • Deals
  • Comparisons
  • Tutorials
No Result
View All Result
SimonHosting
No Result
View All Result

How to Increase PHP Memory Limit in WordPress (4 Methods)

Alfredo Vilar by Alfredo Vilar
October 17, 2026
in Tutorials
How to Increase the PHP Memory Limit for WordPress
📋Editorial transparency: Some links in this guide are affiliate links; if you purchase, we may earn a commission at no extra cost to you. This never influences our recommendations or the instructions we publish.

Learning how to increase the PHP memory limit in WordPress is the fastest way to fix the dreaded “Fatal error: Allowed memory size of X bytes exhausted” message. When your site runs heavy page builders, WooCommerce extensions, or media processing scripts, WordPress can quickly hit its default memory ceiling and crash.

This guide walks you through checking your current allocation and raising it safely using four verified methods: cPanel’s PHP configuration tools, wp-config.php, php.ini, and .htaccess. Whether your site runs on our top WordPress recommendation from our HostArmada review or another host, the whole fix takes less than ten minutes.

What Is the WordPress PHP Memory Limit and How Much Do You Need?

Every time a visitor loads a page or you run a task inside your dashboard, your web server executes PHP scripts in the background. To stop poorly coded scripts or traffic spikes from consuming all of the server’s physical RAM, both PHP and WordPress enforce a per-script memory limit.

Based on official WordPress core documentation, WordPress defines two separate memory constants that interact with your server’s underlying PHP limit:

  • WP_MEMORY_LIMIT: Controls the maximum RAM available for standard front-end requests. By default, WordPress attempts to set this to 40M for single sites and 64M for Multisite networks if the server configuration is lower.
  • WP_MAX_MEMORY_LIMIT: Controls the RAM limit for memory-intensive tasks inside the /wp-admin/ dashboard, such as uploading large images or updating plugins. WordPress defaults this setting to 256M.
  • Server memory_limit (PHP): The hard ceiling set by your web host in php.ini. WordPress can never use more memory than your hosting server allows, even if you type a higher number into your WordPress files.

Recommended PHP Memory Limits by Site Type

Most modern WordPress plugins need significantly more than the legacy 40M default. Use the table below to choose the right target value before editing your settings.

Website TypeRecommended WP_MEMORY_LIMITRecommended WP_MAX_MEMORY_LIMIT
Simple blog or brochure site with lightweight plugins128M256M
Standard business site using Elementor, Divi, or Beaver Builder256M256M or 512M
WooCommerce store, LMS, or membership website256M or 512M512M

What You Need Before You Start

Because you have four different ways to raise your memory allocation, you only need access to your hosting control panel or your server files. Gather these prerequisites before making changes:

  • Hosting control panel or FTP access: You need login access to cPanel (included with hosts like HostArmada, Hosting.com, and several picks in our best WordPress hosting roundup) or an FTP client. If you prefer working via FTP, follow our guide to creating FTP accounts and connecting with FileZilla.
  • WordPress administrator login: Needed to verify your before-and-after memory limits inside the built-in Site Health tool.
  • A full backup of your configuration files: Editing wp-config.php or .htaccess carries a syntax risk, so always download an untouched copy of those files to your computer first.
⚠️

Always back up wp-config.php and .htaccess before editing

A single missing quote, semicolon, or misplaced line in wp-config.php or .htaccess can trigger a critical error or 500 Internal Server Error across your entire site. Download a backup copy of the file before making any edits.

Step 1: Check Your Current PHP Memory Limit in WordPress Site Health

Before changing any files, check what Both WordPress and your hosting server currently report as your active memory limit. WordPress includes a built-in diagnostic page that displays both values side by side.

According to WordPress documentation on the Site Health screen, you can inspect these numbers without installing any extra plugins:

  1. Log in to your WordPress administrator dashboard.
  2. In the left-hand menu, hover over Tools and click Site Health.
  3. Click the Info tab at the top of the screen.
  4. Click the WordPress Constants accordion panel to expand it, and look at the values next to WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT.
  5. Next, click the Server accordion panel below it and look at the value next to PHP memory limit.
ℹ️

Why the Server tab and Constants tab must align

If WP_MEMORY_LIMIT says 256M under WordPress Constants, but PHP memory limit says 128M under Server, your actual limit is still capped at 128M by your host. You must raise the server limit in cPanel (Step 2) for the higher WordPress constant to take effect.

Step 2: Increase the PHP Memory Limit in cPanel (Recommended Method)

Changing the memory limit inside your hosting control panel is the safest and most effective method because it updates the server’s underlying PHP ceiling directly without requiring manual code edits. Depending on how your host configures cPanel, you will use either MultiPHP INI Editor (standard cPanel) or Select PHP Version (CloudLinux cPanel).

Menu labels vary slightly by hosting plan and panel version, so look for the Software section on your main cPanel dashboard.

Option A: Using cPanel MultiPHP INI Editor

Based on official cPanel documentation for the Jupiter theme, follow these steps if your host provides the MultiPHP INI Editor tool:

  1. Log in to cPanel and scroll down to the Software section.
  2. Click MultiPHP INI Editor.
  3. Make sure you are on the Basic Mode tab, then click the Configure PHP INI basic settings dropdown menu and select your domain name.
  4. Scroll down the directive table until you find memory_limit.
  5. In the setting field next to memory_limit, enter 256M (or 512M if your plan supports it).Always include the capital M for megabytes.
  6. Click Apply at the bottom of the table to save your configuration.

Option B: Using Select PHP Version (CloudLinux Selector)

Many shared WordPress hosts (including HostArmada) use CloudLinux’s PHP Selector in cPanel instead. If you see Select PHP Version under Software, use these steps:

  1. In cPanel, open Select PHP Version under the Software section.
  2. Click the Options tab at the top of the screen.
  3. Scroll down to the memory_limit row and click the dropdown value next to it.
  4. Select 256M or 512M from the dropdown list. The page saves your selection automatically and shows a green confirmation notice.

Step 3: Increase WP_MEMORY_LIMIT in wp-config.php

Even if your server allows 256M or 512M in cPanel, WordPress may still hold front-end scripts back at its 40M default unless you explicitly define WP_MEMORY_LIMIT in your wp-config.php file. Combining Step 2 and Step 3 ensures both PHP and WordPress agree on the same limit.

Back up your wp-config.php file first, then follow the official WordPress configuration guide to add the constant:

  1. Open cPanel File Manager (under Files) or connect to your site via FileZilla, and open your site’s root directory (usually public_html).
  2. Right-click wp-config.php, download a backup copy to your computer, and then click Edit.
  3. Scroll down near the bottom of the file and find the line that reads /* That's all, stop editing! Happy publishing. */ (or /* That's all, stop editing! Happy blogging. */ on older installs).
  4. If WP_MEMORY_LIMIT already exists above that line, update its value; otherwise, paste the following lines directly ABOVE the “stop editing” comment line:
define( 'WP_MEMORY_LIMIT', '256M' );

define( 'WP_MAX_MEMORY_LIMIT', '512M' );
  1. Click Save Changes in the top-right corner of File Manager (or save and re-upload the file in FileZilla).
🚫

Never paste code below the stop editing line

In wp-config.php, any constants placed below the require_once ABSPATH . ‘wp-settings.php’; line at the bottom of the file are ignored by WordPress. Always place WP_MEMORY_LIMIT above the stop editing comment.

Step 4: Alternative Methods (php.ini and .htaccess)

If your hosting panel does not use cPanel or does not expose a graphical PHP editor, you can request a higher memory limit by editing .user.ini (or php.ini) or your .htaccess file. Only use these methods if Step 2 was unavailable in your control panel.

Editing php.ini or .user.ini

On modern servers running PHP-FPM or FastCGI, per-directory PHP overrides live in a file named .user.ini or php.ini inside public_html. According to PHP’s official configuration documentation, open (or create) .user.ini or php.ini in your site’s root folder and add this single line:

memory_limit = 256M

Editing .htaccess (Apache Mod_PHP Only)

If your server runs Apache with the legacy mod_php handler or LiteSpeed, you can set the PHP value inside your .htaccess file. Download a backup of .htaccess first, enable Show Hidden Files (dotfiles) in File Manager Settings if you cannot see it, and add this line above # END WordPress:

php_value memory_limit 256M

Step 5: How to Check It Worked

Once you have updated your server PHP settings and saved wp-config.php, verify that the new memory limit is active across both WordPress and the web server.

Follow this quick verification check inside your dashboard:

  1. Log back in to your WordPress dashboard and navigate to Tools > Site Health.
  2. Click the Info tab at the top.
  3. Expand WordPress Constants and verify that WP_MEMORY_LIMIT now shows 256M (or the value you entered).
  4. Expand Server and confirm that PHP memory limit also shows 256M or higher.
  5. Re-run the action that previously triggered the fatal memory error (such as saving a page in your builder or activating a plugin) to confirm the error is gone.
Hosting offer: ScalaHostingMy #1 Hosting Pick
ScalaHosting logo

ScalaHosting

9.8/10 overall

The best all-around web host for performance, security, and support, independently owned and built around its own SPanel technology.

  • SPanel control panel
  • SShield security
  • Managed cloud VPS
  • Flexible scaling
  • Independent ownership
Up to
75% OFF

plans from $2.95/mo

Visit ScalaHosting↗ View offer on provider website

* Introductory price. Renewal rates apply. Anytime money-back guarantee.

Check out my ScalaHosting Review and grab the latest discount on my #1 web hosting pick for 2026.

If your current host locks your PHP memory limit at 64M or 128M on shared plans and refuses to raise it, see how better-resourced hosts compare in our InMotion Hosting review or our ScalaHosting review for managed VPS plans with dedicated RAM.

Troubleshooting When the PHP Memory Limit Will Not Increase

If you followed the steps above and either your limit stays stuck at the old number or your site displays an error, use the fixes below to resolve the issue.

500 Internal Server Error After Editing .htaccess

If your entire website immediately shows a 500 Internal Server Error after adding php_value memory_limit 256M to .htaccess, your server runs PHP in CGI, FastCGI, or PHP-FPM mode rather than as an Apache module. Open File Manager or FileZilla right away, remove the php_value memory_limit line from .htaccess (or restore your backup), and use the cPanel MultiPHP INI Editor or .user.ini method instead.

Site Health Still Shows the Old PHP Memory Limit

When WP_MEMORY_LIMIT updates under WordPress Constants, but the Server tab remains stuck at a lower number like 64M or 128M, your hosting provider has enforced a hard server-level cap in the master PHP configuration. On entry-level shared hosting plans, hosts often ignore local php.ini overrides above their plan limit; contact your host’s support team to ask if they can raise the cap or if an upgrade is required.

The Memory Exhausted Error Still Happens at 256M or 512M

If your server allows 256M or 512M and a single page load still exhausts all available memory, you likely have a plugin memory leak, an unoptimized database query, or an infinite redirect loop in a theme function. Check your error_log file in public_html (or enable WP_DEBUG_LOG) to see which exact plugin or theme file path appears at the end of the fatal error message, then deactivate that plugin via FTP or cPanel.

Syntax Error After Editing wp-config.php

If your site shows a critical error or a parse error referencing a line number in wp-config.php, check the quotation marks around WP_MEMORY_LIMIT and 256M. WordPress requires plain straight single quotes ('), never curly smart quotes copied from a word processor, and every define() line must end with a semicolon (;).

FAQ: How to Increase PHP Memory Limit in WordPress

What is the recommended PHP memory limit for WordPress?

A PHP memory limit of 256M is the recommended standard for most modern WordPress websites. If you run a large WooCommerce store, a multi-language plugin like WPML, or heavy visual page builders, raising WP_MAX_MEMORY_LIMIT to 512M provides helpful extra headroom for admin tasks.

Can I increase the WordPress PHP memory limit with a plugin?

Usually no, because a WordPress plugin cannot override a hard server-level memory_limit ceiling enforced by your web host’s master php.ini file. Adjusting the limit through cPanel’s PHP tools and wp-config.php is safer and does not add another plugin to your site.

Is it safe to set the PHP memory limit to 1024M or -1 (unlimited)?

No, setting your PHP memory limit to -1 (unlimited) or an excessively high number like 1024M on a shared or VPS server is dangerous. If a buggy plugin enters an infinite loop, a single web request can consume all physical RAM on your server and crash your entire hosting account or database.

Why do WP_MEMORY_LIMIT and PHP memory_limit show different numbers?

WP_MEMORY_LIMIT is a WordPress-specific setting inside wp-config.php, while memory_limit is the master PHP setting configured on your web server. For WordPress to actually use 256M of memory, both your server’s PHP memory_limit and your WordPress WP_MEMORY_LIMIT must be set to at least 256M.

Next Steps

Now that you know how to increase the PHP memory limit in WordPress and verify the change in Site Health, your plugins and theme builders have the breathing room they need to run without fatal crashes. To lock down your server directories or compare hosts that provide generous PHP resources out of the box, explore the guides below.

Read next

  • Best WordPress Hosting Providers Compared
  • HostArmada Review: Speed, Security, and cPanel Walkthrough
  • How to Password Protect a Folder in cPanel (Step-by-Step Guide)

You might also like

How to Set Up a 301 Redirect in cPanel and Test the Destination

How to Set Up a 301 Redirect in cPanel and Test the Destination

October 17, 2026
How to Use the Zone Editor to Add or Edit DNS Records

How to Use the Zone Editor to Add or Edit DNS Records

October 17, 2026
How to Change Your cPanel Password and Update Contact Information

How to Change Your cPanel Password and Update Contact Information

October 17, 2026
How to Enable Two-Factor Authentication for Your cPanel Login

How to Enable Two-Factor Authentication for Your cPanel Login

October 17, 2026
Alfredo Vilar

Alfredo Vilar

Alfredo Vilar reviews web hosting, VPS, and managed cloud services. He has 10 years of expertise in WordPress and nearly a decade of experience as a cloud engineer. He focuses on real-world performance rather than marketing claims, and he has worked with many providers. He is experienced with cPanel, web development, AI-assisted coding, Astro, VPS setups, and hosting scalability. He also runs the YouTube channel SimonHosting (2K subscribers), where he has covered cloud, web hosting, and website development for over four years.

Related articles

How to Set Up a 301 Redirect in cPanel and Test the Destination

How to Set Up a 301 Redirect in cPanel and Test the Destination

by Alfredo Vilar
October 17, 2026

Editorial transparency: Some links in this guide are affiliate links; if you purchase, we may earn a commission at no...

How to Use the Zone Editor to Add or Edit DNS Records

How to Use the Zone Editor to Add or Edit DNS Records

by Alfredo Vilar
October 17, 2026

Editorial transparency: Some links in this guide are affiliate links; if you purchase, we may earn a commission at no...

How to Change Your cPanel Password and Update Contact Information

How to Change Your cPanel Password and Update Contact Information

by Alfredo Vilar
October 17, 2026

Editorial transparency: Some links in this guide are affiliate links; if you purchase, we may earn a commission at no...

How to Enable Two-Factor Authentication for Your cPanel Login

How to Enable Two-Factor Authentication for Your cPanel Login

by Alfredo Vilar
October 17, 2026

Editorial transparency: Some links in this guide are affiliate links; if you purchase, we may earn a commission at no...

Next Post
How to Use MultiPHP Manager to Change PHP Versions Per Domain

How to Use MultiPHP Manager to Change PHP Versions Per Domain

Recommended

ScalaHosting Review 2026 My Honest Test After 1 Year

ScalaHosting Review 2026: My Honest Test After 1 Year

ScalaHosting Coupon 2026_ Early Black Friday Deal

ScalaHosting Coupon 2026: Early Black Friday Deal

October 28, 2026
Best Blog Hosting in 2026

Best Blog Hosting in 2026: 7 Hosts Tested & Ranked

October 6, 2026
Is ScalaHosting Good for WordPress (Honest Review)

Is ScalaHosting Good for WordPress? Review 2026

October 28, 2026
Bluehost vs HostGator

Bluehost vs HostGator 2026: Which Host Should You Pick?

October 6, 2026
Hostinger vs HostGator

Hostinger vs HostGator 2026: Which Host Wins?

October 16, 2026
Hostinger vs Cloudways

Hostinger vs Cloudways 2026: Which Cloud Host Wins?

October 6, 2026
Black Friday Offer: ScalaHostingMy #1 Pick
ScalaHosting logo

ScalaHosting

9.8/10 overall

Managed Cloud VPS Hosting for bloggers, ecommerce, online businesses, and growing WordPress sites.

  • Dedicated CPU and RAM
  • Fully managed service
  • Free website migration
72% OFF

Entry Cloud plan

Claim 72% off↗ View offer on provider website

72% off the Entry Cloud plan. Check billing term, renewal pricing, and current provider terms.

  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions

No Result
View All Result
  • Best Web Hosting
  • Reviews
  • Deals
  • Comparisons
  • Tutorials