
When running a WordPress website, the PHP memory limit is crucial to how smoothly everything works. This limit decides how much server memory your site can use for loading pages, plugins, themes, processing media files, or managing big tasks like backups. If the memory limit is too low, your website can face problems such as crashing, showing critical errors, or slowing down.
For example, you may see messages like “Fatal error: Allowed memory size of xxxx bytes exhausted” when you try to update your site or install a plugin. Another issue is the “Fatal error: Out of memory” message, which can stop your WordPress website from loading properly.
These happen when your site tries to use more memory than allowed. When that happens, your site can stop working properly, frustrating visitors and affecting your WordPress site’s performance. However, fixing this issue is easier than you may think and doesn’t require any technical skills.
This tutorial shows you how to increase and verify your WordPress memory limit. We also give you some useful tips to manage memory efficiently.
KEY TAKEAWAYS
- The WordPress memory limit controls how much server memory your WordPress site can use to handle tasks.
- A low memory limit can cause errors, such as slow pages, crashes, or fatal errors.
- You can increase the PHP memory limit by editing the wp-config.php file, .htaccess, or php.ini files or using the hosting control panel.
- Verify the new memory limit is successfully updated through the WordPress dashboard, plugins, or server tools like phpinfo().
- If changes don’t work, contact your hosting provider for further support.
- Regular backups before making any changes are essential to avoid losing data.
- Monitor your site’s performance after increasing the memory limit to ensure everything runs smoothly.
- Upgrading to a hosting plan with more RAM can provide a long-term solution for memory-related issues.
- Taking preventative steps like deactivating unused plugins, using lightweight themes, and keeping everything updated ensures efficient memory use.
Table of Contents
What is WordPress Memory Limit?
The WordPress PHP memory limit is the maximum amount of server memory your website can use to run plugins and themes, or process data. PHP, the WordPress programming language, sets this limit. It ensures your WordPress website has the resources to perform smoothly without overwhelming the server.
The memory limit is directly tied to your server’s RAM. Hosting plans offer different levels of RAM depending on the type of hosting. For instance, shared hosting provides less memory than cloud or dedicated hosting. If your hosting plan has low RAM, your website may struggle to handle resource-heavy tasks.
However, when your site has enough memory, it can load pages faster, handle more visitors, and run multiple plugins without problems.
As per the WordPress Developer Resources, WordPress sets the default memory limit to 40MB for single-site installations and 64MB for multisite setups. While this is enough for basic WordPress websites, larger or more complex sites often need more memory to avoid performance issues. If your site has heavy plugins, large media files, or gets a lot of traffic, increasing the memory limit can help it run smoothly.
How to Increase WordPress Memory Limit?
There are 4 methods to increase the PHP WordPress memory limit, preventing errors and improving your site’s performance. You can choose the one that works best for your experience and hosting setup:
- Edit wp-config File
- Update php.ini File
- Modify .htaccess File
- Upgrade Hosting Plan.
For the first 3 methods, you use an FTP client (like FileZilla) or the Hosted.com File Manager to access given files. For this tutorial, we use File Manager.
Remember, the effectiveness of changing the WordPress memory limit depends largely on how your hosting environment is configured. Factors like hosting provider restrictions, server settings, control panel variations, user permissions, and potential conflicts with plugins or themes can all influence whether these changes work as intended.
Because of these variables, we can’t promise that every solution will work for everyone. That’s why we’ve provided 4 different methods, to ensure that at least one should be compatible with your specific hosting setup. Let’s start with the first method:
Edit wp-config.php File
One of the easiest ways to increase your WordPress memory limit is by editing the wp-config.php file. How? The wp-config.php file overrides default WordPress settings, to customize memory limits directly. This file is in your website’s root directory and it contains important WordPress site settings. Here’s how to modify it using the Hosted.com File Manager:
First, log in to the Hosted.com control panel (cPanel). Navigate to Files → File Manager. In the File Manager window, scroll to public_html and click on it. Find the wp-config.php file. This is one of the core configuration files for your WordPress site.
Select the wp-config.php file and click Edit to open it in the control panel’s built-in editor. We recommend creating a backup of the wp-config.php file before making any changes to it.

Next, look for the line that says:
/* That's all, stop editing! Happy publishing. */
Just above this line, add the following code:
define('WP_MEMORY_LIMIT', '256M');
This increases the memory limit to 256MB, which is suitable for most WordPress sites.
Then, click Save Changes to save the modifications to the file.

Now, refresh your website to ensure everything is working correctly. If the site loads properly without errors, the memory limit has been increased successfully.
Update php.ini File
The php.ini file is a configuration file that controls how PHP works on your server. It’s like a set of rules that tells PHP how much memory your WordPress website can use, among other settings.
Before we go into details, it’s important to note that if you’re using shared hosting, the provider usually won’t allow you to configure the php.ini file directly. Instead, you may find an alternative file named .user.ini. Or, there may be no available file; in that case, you should edit memory settings through your hosting control panel.
Let’s consider the above scenarios and learn how you can increase the WordPress memory limit:
First, locate the php.ini file. The php.ini file’s location can vary based on your server setup, PHP version, and operating system. When PHP runs, it looks for this file in specific locations, including:
- The server application programming interface (SAPI) module-specific directory.
- The PHP runtime configuration (PHPRC) environment variable.
- The current working directory is identified using the getcwd() function.
- The directory where PHP or the web server is installed.
Instead of manually searching for the php.ini file through your hosting provider’s File Manager feature, simpler, automated methods are available.
For example, connect to your server via SSH and run the following command:
php --ini
This will show the php.ini file’s location next to the Loaded Configuration File.

Or, you can create a new phpinfo.php file in the public_html folder and write the following code into it:
<?php
phpinfo();
?>
Save your file and type the following link into your browser. Ensure you replace domain.tld with your own domain name:
domain.tld/phpinfo.php
This will also show you the php.ini file’s location.

Once located, head to the file and open it in the editor. Now, update the value of memory_limit. In our example, it’s 256M.

However, if there’s no php.ini file, you can create it yourself in your WordPress website’s root directory and add the following line to it:
memory_limit = 256M
Remember, if you have .user.ini instead of a php.ini file in the rootdirectory, open it and update the value of the memory_limit parameter as we did for the php.ini file above.
Lastly, if you can’t find any of these files, sign in to your web hosting control panel (e.g., cPanel) and go to Software → MultiPHP INI Editor.

Switch to Basic Mode. Choose your domain from the dropdown menu. Now scroll to the memory_limit parameter and update its value per the requirements. After that, scroll down to the bottom and click Apply to save changes.

The WordPress Memory Limit or PHP Memory Limit is the pre-determined maximum amount of memory (RAM) your website can use, ensuring your website scripts don’t exceed your hosting plan’s RAM allocation.
To optimize your site’s performance, consider upgrading to a
WordPress Hosting plan at Hosted.com that offers the right memory limits for your needs.
Modify .htaccess File
If the WordPress memory limit has not increased yet, edit .htaccess file. Web servers like Apache use this configuration file to manage server settings. You can increase WordPress’s PHP memory limit when you use it. Here’s how you can do it using the Hosted.com cPanel:
Log in to cPanel and go to Files → File Manager to access your WordPress site’s files. Navigate to the root directory of your WordPress installation.

In the root directory, look for a file named .htaccess. We recommend downloading a copy of the .htaccess file to your PC as a backup. This way, you can easily restore it if anything goes wrong. Select this file and click Edit to open it in the editor.

Once the file is opened, add the following code after # End WordPress line:
php_value memory_limit 256M
Then, click Save Changes to save your file.
This increases the memory limit to 256MB. You can adjust the value (e.g., 512M or 128M) based on your website’s requirements.

Important:
If you don’t see a .htaccess file, ensure your File Manager is set to show hidden files. However, if the .htaccess file is missing, you can create a new one and name it .htaccess.
Upgrade Hosting Plan
If your WordPress site has increased traffic or experiences errors, slow performance, or crashes even after increasing the PHP memory limit, you may need to upgrade your hosting plan. Upgrading gives your website access to more server resources, like higher RAM and processing power, ensuring smooth operation even under heavy use.
An upgraded hosting plan offers several advantages. With more memory and resources, your WordPress site can handle tasks efficiently without errors or downtime. Greater server performance also leads to faster loading speeds; this improves the user experience and benefits SEO rankings.
Additionally, upgrading gives your WordPress website room to grow. Whether it’s accommodating more visitors, larger media files, or additional plugins, a more powerful hosting plan ensures your site can scale with your needs.
Now, let’s discuss upgrading your hosting plan, which is straightforward. Start by logging into your hosting dashboard to review the details of your current plan. Assess your website’s requirements, including traffic levels and the plugins or themes you’re using. Look for plans that offer higher RAM, better CPUs, and increased PHP memory limits.
Next, contact your hosting provider’s support team for assistance in selecting the right plan. Hosting companies often have several options, such as VPS Hosting for moderate traffic or dedicated hosting for larger, high-traffic WordPress websites. Once you’ve chosen the right plan, your provider will help you switch seamlessly.
Verify Increased Memory Limit
After increasing your WordPress memory limit, verify that the changes have been applied successfully. Also, ensure your site has the resources to perform tasks efficiently. You can check this using the WordPress Dashboard or other simple methods. Here’s how:
Use WordPress Dashboard
The easiest way to check your memory limit is through the WordPress Site Health tool. This method is beginner-friendly and doesn’t require additional tools or technical knowledge. Here’s how to use this approach:
Login to your WordPress Dashboard. Go to Tools → Site Health from the sidebar menu. Click Info at the top of the Site Health page.

Scroll down and expand the Server section. Then, look for the line that says PHP memory limit to see the current limit applied to your WordPress site.

Alternative Methods
If you want to confirm the WordPress memory limit using other methods, there are a few additional options available:
One simple way is to use a plugin, such as WP Tools or WP Memory; this simplifies viewing server details directly in your WordPress dashboard. Once installed and activated, these plugins will display important server information, including the current PHP memory limit, without requiring any coding.
Another option is using PHP code. Add a small code snippet to your theme’s functions.php file or a custom plugin. Here’s the code you need:
echo 'Memory Limit: ' . ini_get('memory_limit');
Once you’ve added this, visit your site, and the current memory limit will appear on the top-left side of the page. This is quick and effective if you’re comfortable with minor file edits.
A third method involves checking server information using phpinfo(). Create a file called phpinfo.php in your WordPress site’s root directory and write this code:
<?php phpinfo(); ?>
After saving the file, open it in your browser by visiting:
yourdomain.com/phpinfo.php
This will display detailed PHP configuration settings, including the current memory limit. To maintain your website’s security, ensure you delete the file after use.
These alternative methods are useful for verifying the memory limit, especially when you need flexibility or a deeper understanding of your server’s configuration. If the updated limit isn’t showing, contact your hosting provider.
Tips for Managing WordPress Memory Limit Efficiently
Managing your website’s memory efficiently helps ensure smooth performance and prevents errors. Here are some simple tips to optimize your WordPress site:
1. Deactivate Unnecessary Plugins: Every plugin you install uses memory. If there are plugins you’re not actively using, deactivate or delete them. This will lessen the load on your server and improve your WordPress site’s speed.
2. Use Lightweight Themes: Some themes include numerous built-in features that consume extra memory. Switching to a lightweight theme can free resources and help your site run faster. Popular options like Astra or GeneratePress are great for balancing design and performance. You can also refer to our tutorial, How to Choose a WordPress Theme: A Beginner’s Guide, to select the right theme for your site.
3. Optimize Your Database Regularly: Over time, your WordPress database collects unused data like old revisions, spam comments, or transient files. Use plugins like WP-Optimize to clean up your database and improve your site’s efficiency.
4. Monitor Resource Usage: Watch how your website uses resources. Tools like Query Monitor or your hosting control panel can show you which plugins or processes consume the most memory. This allows you to make necessary adjustments.
Preventive Measures
In addition to managing WordPress memory, taking preventive steps is essential to avoid performance issues and keep your website running smoothly. To do this:
Regularly monitor your site’s performance – this is a simple and effective way to ensure everything works properly. It helps you analyze your WordPress website’s speed and detect potential issues. Review your site’s performance regularly to pinpoint and fix problems before they escalate into bigger challenges.
Keep your plugins and themes updated, as outdated or incompatible versions can lead to compatibility issues, security vulnerabilities, and increased memory usage. Staying updated with the latest versions ensures your website runs efficiently and avoids unnecessary memory strain.
Finally, consider using managed WordPress hosting. Managed hosting is designed specifically for WordPress sites and often includes features like automatic memory management, real-time performance monitoring, and expert support. This type of hosting simplifies maintenance and ensures your website remains quick, reliable and optimized for the best user experience.
If you take these preventive steps, you will maintain a stable and efficient WordPress website and minimize the risk of memory-related problems. Therefore, regular attention to your site’s performance, updates, and hosting environment will ensure long-term success.
FAQs
Why is increasing the memory limit important for WordPress?
Increasing the memory limit ensures your WordPress site has enough resources to handle demanding tasks like running multiple plugins, processing large images, or managing high traffic. Without enough memory, your site may experience crashes, slow loading times, or errors that can frustrate users and impact your SEO rankings.
Why did my WordPress memory limit change not take effect?
If increasing the memory limit doesn’t work, your hosting provider may have a maximum limit set at the server level. In this situation, contact your hosting provider to increase the limit or upgrade your hosting plan for more resources.
What’s the difference between the PHP memory limit and server RAM?
The PHP memory limit is the amount of memory allocated for PHP scripts, like running WordPress. Server RAM refers to the total physical memory available on your server. A hosting plan with more RAM allows for higher PHP memory limits, but the two aren’t the same. If your server only has limited RAM, increasing PHP memory may not work.
Do plugins and themes impact memory usage?
Yes, plugins and themes can significantly affect memory usage. Heavy plugins like WooCommerce or complex themes with multiple features often require more memory. Deactivating unused plugins and switching to lightweight themes can help reduce memory strain and improve performance.
Is upgrading my hosting the only solution for persistent memory issues?
Upgrading your hosting is one option, but not the only one. Optimizing your site using caching, reducing large media files, and disabling unnecessary features can help reduce memory consumption. If these steps don’t work, upgrading to a hosting plan with more resources may be necessary.
Other Related Tutorials:
– WordPress Hacked: How to Check, Repair, And Prevent Future Hacks
– How To Create A Membership Website In WordPress
– How To Add Google Analytics To WordPress: A Step-by-Step Guide
– WooCommerce Shortcodes: A Guide to Their Uses & Benefits
– WordPress do_shortcode: Tips & Tricks For Optimal Usage