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 to40Mfor single sites and64Mfor 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 to256M.- Server
memory_limit(PHP): The hard ceiling set by your web host inphp.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 Type | Recommended WP_MEMORY_LIMIT | Recommended WP_MAX_MEMORY_LIMIT |
|---|---|---|
| Simple blog or brochure site with lightweight plugins | 128M | 256M |
| Standard business site using Elementor, Divi, or Beaver Builder | 256M | 256M or 512M |
| WooCommerce store, LMS, or membership website | 256M or 512M | 512M |
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.phpor.htaccesscarries 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:
- Log in to your WordPress administrator dashboard.
- In the left-hand menu, hover over Tools and click Site Health.
- Click the Info tab at the top of the screen.
- Click the WordPress Constants accordion panel to expand it, and look at the values next to WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT.
- 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:
- Log in to cPanel and scroll down to the Software section.
- Click MultiPHP INI Editor.
- Make sure you are on the Basic Mode tab, then click the Configure PHP INI basic settings dropdown menu and select your domain name.
- Scroll down the directive table until you find memory_limit.
- In the setting field next to memory_limit, enter
256M(or512Mif your plan supports it).Always include the capitalMfor megabytes. - 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:
- In cPanel, open Select PHP Version under the Software section.
- Click the Options tab at the top of the screen.
- Scroll down to the memory_limit row and click the dropdown value next to it.
- Select
256Mor512Mfrom 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:
- Open cPanel File Manager (under Files) or connect to your site via FileZilla, and open your site’s root directory (usually
public_html). - Right-click
wp-config.php, download a backup copy to your computer, and then click Edit. - 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). - If
WP_MEMORY_LIMITalready 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' );- 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 = 256MEditing .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 256MStep 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:
- Log back in to your WordPress dashboard and navigate to Tools > Site Health.
- Click the Info tab at the top.
- Expand WordPress Constants and verify that WP_MEMORY_LIMIT now shows
256M(or the value you entered). - Expand Server and confirm that PHP memory limit also shows
256Mor higher. - 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.

ScalaHosting
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
* 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.
















