How to Increase PHP Memory Limit in WordPress Easily
Share
When we start building a WordPress website, everything feels fast and smooth. Pages load quickly, plugins install easily, and the dashboard responds without delay. But as we continue adding themes, page builders, SEO tools, security plugins, and images, we may begin to notice slow performance, failed updates, or even scary error messages. This can be frustrating, especially when we don’t know what caused the problem. In many cases, the issue is not with WordPress itself, but rather that our website has run out of available memory.
We often don’t think about server memory while growing our site, yet it plays a big role in how well everything works behind the scenes. When memory is too low, tasks stop working properly. The good news is that we can fix this by learning how to increase PHP memory limit and give our website the resources it needs to run smoothly and reliably.
What is Increase PHP Memory Limit?
Increasing PHP Memory limit means raising the amount of memory that PHP scripts are allowed to use on your web server. PHP is the language that runs platforms like WordPress and many web applications. By default, hosting providers set a memory limit to prevent one website from consuming too many server resources.
When your website runs heavy tasks such as plugins, themes, image processing, or large database queries, it may exceed the default memory limit. This can cause errors like “Allowed memory size exhausted”, slow performance, or failed updates.
Increasing the PHP memory limit gives your website more resources to handle complex processes smoothly. This improves performance, prevents crashes, and ensures plugins, themes, and scripts run properly. It is commonly adjusted in the php.ini file, .htaccess, or wp-config.php, depending on your hosting setup.
What Causes Memory Exhaustion?
Low memory errors in WordPress usually happen when your website tries to use more server resources than the allocated PHP memory allows.
Heavy Plugins & Page Builders: Heavy plugins like page builders, backups, security tools, and SEO suites consume significant memory, and running several at once may require you to increase the WordPress memory limit to avoid errors and slowdowns. You should also optimize WordPress themes for SEO by using lightweight, well-coded themes that improve performance and search visibility.
Poorly Coded Themes: Themes with inefficient coding, excessive scripts, or built-in features that load unnecessary assets can increase memory usage. Switching to a lightweight, optimized theme can reduce the need to increase wp memory limit.
Large & Unoptimized Images:Uploading high-resolution images forces WordPress to create multiple thumbnail sizes, which requires extra memory. If images are not compressed, memory usage increases during processing.
High Traffic & Concurrent Users: When many visitors access your site at the same time, the server must run multiple PHP processes. This increases memory demand and may cause exhaustion if limits are too low.
WooCommerce & Dynamic Content: Ecommerce sites process cart sessions, payment requests, and real-time product data. These dynamic operations consume more memory compared to static websites.
Background Tasks & Scheduled Processes: Automated backups, malware scans, cron jobs, and scheduled tasks run in the background and use memory. If several tasks run simultaneously, they can exceed available resources.
Understanding these causes helps you identify performance bottlenecks and decide when to increase PHP memory limit for smoother website operation. By optimizing resources and allocating sufficient memory, you can prevent crashes, improve speed, and ensure your WordPress site runs reliably.
4 Proven Methods to increase PHP memory limit in WordPress
If your website is showing fatal errors, slow dashboard performance, plugin crashes, or “allowed memory size exhausted” messages, it means your server does not have enough allocated PHP memory.
Modern WordPress websites use page builders, WooCommerce, SEO plugins, security tools, and backup systems that require higher server resources. That’s why learning how to increase memory limit is essential for improving website speed, stability, and overall performance. Below are four reliable and detailed methods you can use to safely increase memory allocation and prevent WordPress memory exhaustion issues.
Method 1: Increasing Memory Limit via wp-config.php
To increase PHP memory limit through the wp-config.php file is one of the safest and most effective ways to resolve memory-related errors such as “Allowed memory size exhausted.”
Step 1: Log in to Your Hosting Account
Access your hosting control panel (such as cPanel, Plesk, or a custom dashboard).
If you use cPanel:
Go to File Manager
Navigate to the public_html folder (or your WordPress root directory)
If you use FTP:
Open an FTP client like FileZilla
Connect using your FTP credentials
Locate your WordPress root folder
Your WordPress root folder contains files like:
wp-admin
wp-content
wp-includes
Step 2: Locate the wp-config.php File
Inside the root directory, find the file named:
wp-config.php
This file controls core WordPress configuration settings, including database connection and memory limits.
Before editing, create a backup copy of the file. This ensures you can restore it if something goes wrong.
Step 3: Open wp-config.php for Editing
Right-click the file and choose:
Edit (in File Manager) or
Open it in your FTP text editor
You will see several configuration lines inside the file.
Step 4: Find the “That’s all, stop editing!” Line
Scroll down until you see this line:
/* That's all, stop editing! Happy publishing. */
You must add the memory limit code just above this line.
Step 5: Add the Memory Limit Code
Insert the following line above the “That’s all” comment:
define('WP_MEMORY_LIMIT', '256M');
This increases the WordPress memory limit to 256MB.
If you run a WooCommerce store or use heavy plugins, you can increase it further:
define('WP_MEMORY_LIMIT', '512M');
For admin-heavy tasks like imports or backups, you may also add:
define('WP_MAX_MEMORY_LIMIT', '512M');
This specifically increase PHP memory limit for the WordPress admin dashboard.
Step 6: Save the File
Click Save after adding the code.
If using FTP:
Save the file locally
Upload it back to overwrite the original
Step 7: Verify the Memory Limit
To confirm the change:
Log in to your WordPress dashboard
Go to Tools → Site Health → Info → Server
Check the PHP memory limit
Alternatively, you can use a plugin like Query Monitor to confirm the memory allocation.
Step 8: Clear Cache (If Applicable)
If you use caching plugins or server-level caching:
Clear your WordPress cache
Clear server cache
Clear CDN cache (like Cloudflare, if used)
This ensures the new configuration loads properly.
Method 2: Increasing Memory Limit via php.ini Configuration
The php.ini file controls your server’s core PHP settings, including the memory limit allocated to PHP scripts. Increasing this value helps resolve memory exhaustion errors, especially for resource-heavy WordPress or WooCommerce websites. Follow these steps carefully:
Step 1: Locate Your php.ini File
First, you need to find where your php.ini file is stored.
Common locations include:
/public_html/
/home/username/
/etc/php/7.x/apache2/
/etc/php/8.x/fpm/
If you're unsure:
Log in to your hosting control panel (such as cPanel or Plesk).
Use File Manager and search for php.ini.
Alternatively, create a file named phpinfo.php in your root directory with this code:
<?php phpinfo(); ?>
Open it in your browser and look for Loaded Configuration File to see the exact path.
Step 2: Open the php.ini File
Once located:
Open the file using File Manager (Edit option), or
Access it through FTP (using FileZilla or similar), or
Edit via SSH if you have server access.
Make sure to create a backup before editing.
Step 3: Find the memory_limit Directive
Inside the php.ini file, search for:
memory_limit =
You may see something like:
memory_limit = 128M
Step 4: Increase PHP Memory Limit
Change the value to a higher limit depending on your needs.
For example:
memory_limit = 256M
Or for high-resource WooCommerce stores:
memory_limit = 512M
For most WordPress and WooCommerce websites, 256M is generally sufficient.
Step 5: Save the File
After updating the value:
Click Save in File Manager, or
Upload the updated file via FTP.
Step 6: Restart the Web Server (If Required)
On VPS or dedicated servers, changes may not apply immediately. You may need to restart:
Apache
Nginx
PHP-FPM
If you are on shared hosting, your hosting provider may automatically apply changes.
Step 7: Verify the New Memory Limit
To confirm the change:
Refresh your phpinfo.php page.
Look for the updated memory_limit value.
You can also check inside your WordPress dashboard:
Go to Tools → Site Health → Info → Server
This method provides a direct and server-level solution, making it one of the most effective ways to resolve PHP memory issues.
Method 3: Increasing Memory Limit via .htaccess File
This method works for most shared hosting environments that run Apache servers. It allows you to increase PHP memory limit without accessing server-level settings.
Step 1: Log in to Your Hosting Account
Open your hosting provider’s dashboard.
Log in using your credentials.
Navigate to File Manager.
If you use cPanel, go to:
cPanel → File Manager → public_html
If your WordPress site is installed in a subfolder, open that specific directory instead.
Step 2: Locate the .htaccess File
Inside your WordPress root directory (usually public_html), find:
.htaccess Important:
If you don’t see the file, enable “Show Hidden Files (dotfiles)” in File Manager settings.
The .htaccess file starts with a dot, so it remains hidden by default.
Step 3: Create a Backup (Highly Recommended)
Before editing:
Right-click .htaccess
Click Download
Save a backup copy to your computer
This helps you restore the site if anything goes wrong.
Step 4: Edit the .htaccess File
Right-click .htaccess
Click Edit
Add the following line at the bottom of the file:
php_value memory_limit 256M
You can adjust the value depending on your needs:
128M – Moderate websites
256M – Recommended for WooCommerce or heavy themes
512M – Large websites with many plugins
If you run a WooCommerce or feature-rich site, 256M is usually ideal.
Step 5: Save Changes
After adding the line:
Click Save Changes
Close the editor
Step 6: Check If It Worked
To verify:
Log in to WordPress Admin
Go to:
Tools → Site Health → Info → Server
Look for PHP memory limit
Or install a plugin like:
WP-ServerInfo
WP Health Check
If the limit has updated, the change was successful.
Method 4: Increase PHP Memory Limit via Hosting Control Panel Settings
Increasing your PHP memory limit through your hosting control panel is one of the safest and easiest ways to resolve “Allowed memory size exhausted” errors in WordPress or WooCommerce. This method does not require editing core files, and most hosting providers support it.
Step 1: Log in to Your Hosting Account
First, log in to your hosting provider’s dashboard.
Most hosting providers offer one of the following control panels:
cPanel
Plesk
A custom dashboard (like Bluehost, Hostinger, SiteGround, etc.)
Locate the section labeled Control Panel, Advanced, or Hosting Settings.
Step 2: Open the PHP Settings or MultiPHP Manager
Inside the control panel, look for one of these options:
Select PHP Version
MultiPHP INI Editor
PHP Configuration
PHP Settings
Software → PHP Options
In cPanel, you typically find:
MultiPHP INI Editor, or
Select PHP Version → Options
Click on it to access PHP configuration settings.
Step 3: Locate the Memory Limit Setting
Once inside the PHP settings panel:
Look for a field labeled memory_limit
You may see a dropdown menu or a text input box
It may currently be set to:
128M
256M
512M
The default value for many shared hosting plans is often 128M, which may not be sufficient for WooCommerce stores, heavy themes, or multiple plugins.
Step 4: Increase PHP Memory Limit
Change the memory limit to a higher value.
Recommended values:
256M → Suitable for most WordPress sites
512M → Recommended for WooCommerce stores or large websites
768M or 1024M → For high-traffic or resource-heavy websites (if hosting plan allows)
Enter the new value (for example: 512M) and save the changes.
Click Save, Apply, or Update depending on your hosting panel.
Step 5: Confirm the Changes
After saving:
Log in to your WordPress dashboard
Go to:
Tools → Site Health → Info → Server
Check the PHP memory limit value
You can also install a plugin like WP Server Info to verify the updated memory limit.
Step 6: Clear Cache (Important)
If you are using:
A caching plugin
Server-level caching
Cloudflare
Clear all caches to ensure the new memory limit reflects properly.
Increasing memory through the hosting control panel helps prevent WordPress plugin conflicts, improves WordPress admin performance, supports WooCommerce checkout processes, and ensures smooth execution of backup and security scans.
How Much Memory Does WordPress Need?
Memory requirements vary depending on website complexity.
Website Type
Recommended Limit
Personal blog
64MB
Business website
128MB
Portfolio site
128MB
WooCommerce store
256MB
Membership/LMS site
512MB
High-traffic site
512MB+
For most modern websites, 256MB is the recommended baseline.
Conclusion
In conclusion, learning how to increase PHP memory limit is very important for keeping your WordPress website fast, stable, and error-free. When your site runs out of PHP memory, you may see fatal errors, slow-loading pages, plugin crashes, or WooCommerce checkout issues. By increasing WordPress's memory limit, you improve website performance, support heavy plugins, and ensure smooth admin dashboard operations.
Whether you update the wp-config.php file, change PHP settings, or adjust hosting control panel options, giving your site more server resources helps prevent memory exhaustion errors. Always combine memory optimization with website speed optimization, plugin management, and reliable WordPress hosting. With the right memory settings and proper website maintenance, we can improve site performance, enhance SEO rankings, and deliver a better user experience for every visitor.
Frequently Asked Questions (FAQs)
1. What happens if my PHP memory limit is too low?
When your website exceeds its allocated PHP memory, you may see fatal error messages, white screens, or slow dashboard performance. Low memory can also cause plugins, themes, and WooCommerce features to stop functioning properly.
2. How do I know if memory exhaustion is causing website errors?
You may notice an “Allowed memory size exhausted” error message or repeated plugin crashes during updates. Checking your site’s debug log or asking your hosting provider can confirm whether memory limits are the issue.
3. Is increasing the memory limit safe for my website?
Yes, increasing memory is safe as long as it stays within your hosting provider’s allowed server limits. It simply allows PHP processes to use more resources, helping your website run smoothly without interruptions.
4. How much memory should a WooCommerce store have?
Most WooCommerce stores perform best with at least 256MB of PHP memory to handle cart sessions, checkout processes, and dynamic product data. Larger or high-traffic stores may require 512MB or more for optimal performance.
5. Can shared hosting users increase their memory allocation?
Yes, many shared hosting providers allow users to adjust PHP settings through the hosting control panel. If manual file edits do not work, contacting support to increase wp memory limit is often the quickest solution.
6. Does increasing memory improve website speed?
When we increase PHP memory limit, it improves performance if your site previously struggled with resource shortages. However, combining proper optimization, lightweight themes, caching, and quality hosting delivers the best long-term speed improvements.