We are on vacation till 12 July. Support replies might be slower than before. Thank you for being patient and considerate.

wpmet-website-logo
  • Home
  • Plugins
    • ElementsKit
    • ShopEngine
    • MetForm
    • WP Social
    • WP Fundraising
    • Wp Ultimate Review
  • About
  • Blog
  • Support
  • Contact
  • My Account
wordpress plugin

How to Increase WordPress Memory Limit

SanjidaSanjida Updated on: May 25, 2022 WordPress Tutorials 6 Min Read
How-to-increase-memory-limit-in-WordPress_Wpmet

Are you getting a WordPress error that says “Allowed Memory Size Exhausted”?

This is one of the most popular WordPress errors. Though it is simple to increase the WordPress memory limit in just a few steps. 

It’s a WordPress rite of passage to deal with fatal errors. It happens to everybody at some point. 

If you have a hypermedia-heavy website, the regular WP setup will not be sufficient for you, and you will need to upgrade at some stage.

In this article, we’ll guide you on how to increase the WordPress PHP memory limit to correct the WP memory limit or WP memory exhausted error.

Contents hide
What is WordPress Memory Limit Exhausted Error?
What is the WordPress PHP memory limit?
Why does WordPress demand more memory limit, to start with?
What is the Maximum Upload Limit in WordPress?
How to Increase PHP Memory Limit and Maximum Upload Limit in WordPress:
Edit your wp-config.php file
Edit your PHP.ini file
Edit your .htaccess file
Wrapping Up
All-in-one add-on for Elementor - ElementsKit
Get Your All-in-One Add-on for Elementor

What is WordPress Memory Limit Exhausted Error?

PHP is a server-side programming language, and WordPress is written in it. For PHP to work properly, every website needs a WordPress hosting provider.

Web servers operate in the same way as any other device. They need memory to run several applications effectively at the same time. Different programs in WP are allotted different amounts of memory limit by server administrators.

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

Or

Fatal error: allowed memory size of 41943040 bytes exhausted
fatal error allowed memory size WordPress

This error message appears when your WordPress code needs more memory limit than the default allocated memory limitation.

🔔 Another blog…

Do you know that a Wishlist page can also be shared with friends and family, or it can be kept private as a “to-buy later” list. To learn more please visit our latest blog on Best Wishlist Plugins

What is the WordPress PHP memory limit?

PHP is the server-side programming language that creates the website’s HTML pages. 

PHP is a versatile, dynamic programming language that can process WordPress interrogations, perform calculations, and more, but it requires memory to do so.

WordPress’s default memory limit is 32MB, but it’s normal if you’re in need to raise it. For example, WooCommerce recommends a WordPress memory limit of 64MB.

How to Increase WordPress Memory Limit_Wpmet_image 1
WordPress Minimum Memory

As WordPress hits the default memory limit, it will try to raise it to 40MB for single-site installations and 64MB for multisite installations. If that isn’t enough, a fatal error message line will appear.

Unless you installed a plugin that requires more memory, a memory limit of 128MB should suffice for most pages. Install the Server IP & Memory Use Display plugin to see how much memory each plugin consumes.

You can deactivate plugins to see how they affect memory use after you activate the Server IP and Memory Usage Display plugin. To avoid overloading your server, high-quality, all-in-one plugins can make efficient use of memory.

Why does WordPress demand more memory limit, to start with?

To increase the memory limit one needs to increase the maximum upload size in the WordPress wp-config.php memory limit file. 

However, there’s an issue you should be cautious about. Increasing the memory limit will make WordPress inefficiencies harder to identify.

Before you increase the WordPress Memory Limit, I recommend that you first try to figure out what is consuming more memory. More resources thrown at a problem can sometimes end up costing much more in the long term, particularly if you have plans to upgrade the host.

Inefficiencies in WordPress can lead to a sluggish site and a bad user experience. But to get the solution you need to identify the root of the problem, which can help you solve a variety of problems down the road.

Just 4.4% of WordPress websites use the most recent version of PHP, and 64% uses the older version that no longer receives active updates.

Upgrading your hosting server’s PHP to the most recent version would make WordPress more effective and eliminate the need to raise the memory capacity in WordPress.

Most Complete WooCommerce Solution

What is the Maximum Upload Limit in WordPress? 

The maximum upload limit in WordPress refers to the largest file size that WordPress can accept for uploads. The maximum upload capacity in WordPress can be found on the media library upload screen. 

Although this is beneficial to your host, it also improves the efficiency of your site. Large image file uploads, for example, perform poorly on your web because they take a long time to download and present.

🤷‍♀️ Do keep in mind:

Before you spend more money on the issue and raise the WP memory limit, see if there’s anything you can do to diminish the file size first, just as you did with the memory limit.

If your images are a little too big for their container or you haven’t compressed them, you can fix those issues first because they address the root of the problem, which is not properly enhancing your assets. For more details, see our guide on how you can speed up your website.

How to Increase PHP Memory Limit and Maximum Upload Limit in WordPress:

How to Increase WordPress Memory Limit_Wpmet_image 3
How to Increase PHP Memory Limit and Maximum Upload Limit in WordPress

There are three options you can use if you do need to raise the memory capacity and uploading limit in WordPress.

🚨 Always keep a new backup of your site files and database before making any significant changes so that you can recover your site if you make a mistake.


Now let’s get started! 😃

Edit your wp-config.php file

Since it contains your basic configuration information, wp-config.php memory is one of the most popular WordPress files. It’s in the root directory of your wp file system.

wp-config.php file
wp-config.php file

Look for this line to edit the memory and upload limits on the wp-config.php memory file:

WordPress Minimum Memory:

define('WP_MEMORY_LIMIT', '40M');

Increase the value of the second parameter. As previously stated, a PHP memory limit of ‘wp_memory_limit, 128M’ should be sufficient.

define('WP_MEMORY_LIMIT', '128M');

You’re good to go with this wp config.php method. However, If you’re still having a fatal error, you might need to increase it again. But don’t go too far or your server will crash. Or you can seek assistance from your host.

Edit your PHP.ini file

If changing the wp-config.php file doesn’t solve the problem, you’ll have to deal with the problem in your server settings.

You won’t be able to access your PHP.ini file if you’re using shared hosting. If you do have access to PHP.ini. It’s most likely in the root folder, but the file’s location varies by the host. 

Here’s what you need to do:

  • Locate or find your php.ini file. If you can’t find it, simply build your php.ini file and save it in the WordPress installation’s root directory.
  • Use your favorite editor to open and edit your php.ini file.
  • Look for the line that says ‘memory limit = 32M’.
  • Change the 32M or some other number to the desired limit (e.g. 256M or 512M).
  • Restart your localhost or server after saving your changes.

Note: If you’ve made your own php.ini file, you’ll need to add the following line to it:

memory_limit = 256M (or 512M)

In certain instances, as you progress down the list from line one to line three, the values you add can grow larger. The ‘memory limit’ should be the biggest, while the ‘upload max filesize’ should be the lowest. And the ‘post max size’ should be the median.

Clear your browser’s cookies before checking if the error has disappeared.

Edit your .htaccess file

If you don’t have access to PHP.ini, you’ll have to edit your .htaccess file as a last resort. Since it is a secret file, the .htaccess file begins with a mark. Check to see if your SFTP file manager is keeping some files hidden from view if you don’t see them in your root folder.

Here are the details you need to add to your .htaccess file to increase the WordPress memory limit:

php_value memory_limit 256M


php_value upload_max_filesize 12M


php_value post_max_size 13M

Increase the PHP memory caption if it hasn’t already been set. And more detailed information please check out our latest blog Fatal Error Solution below:

Wrapping Up

It can be nerve-wracking to configure the server and deal with fatal errors of increasing the memory limit in the WordPress website. The procedure you must follow is highly dependent on the hosting company you choose, which is why getting a reliable host is so critical. They will assist you in locating and modifying the settings that need to be changed.

However, increasing the wp memory limit for your website through the wp-config file is the easiest method you can count on, the other two can be a little down the line. 

Finally, hope you liked the article. If yes! Then please leave a comment down below as well as join our Wpmet Community on Facebook/Twitter for more exciting updates.

Facebook
Twitter
Youtube

And, Please don’t forget to subscribe to our channel on YouTube for more useful tutorials.

  • Share :

11 Best Mailchimp Plugin for WordPress to Grow Subscribers (Free and Pro)

Previous post

20+ Best Themes for Elementor (Free & Pro)

Next post

4 Comments

  • Reply
    hirendra says:
    August 13, 2021 at 2:15 pm

    What is the Maximum Upload Limit in WordPress?

    • Reply
      Sanjida says:
      August 15, 2021 at 3:39 am

      Hi Hirendra,

      Hope you’re doing well.
      Well, the Maximum Upload Limit of WordPress is 2MB to infinity.

      This limit might be enough for small websites with a limited number of plugins and visitors.

      Thank you so much 💖

  • Reply
    Gayathri Reprographics says:
    January 9, 2022 at 4:42 pm

    Thanks

  • Reply
    Can't edit theme in WordPress? Here are 14 possible solutions! says:
    August 1, 2022 at 5:32 am

    […] Read this resourceful blog post from Wpmet to learn how to increase your WordPress memory limit. […]

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get Subscribed Today!

wpmet-website-logo
Š 2022, Wpmet. All Rights Reserved. Built with ElementsKit.
Elements Kit
ShopEngine
Metform
Wp Fundraising
WP Social
Wp Ultimate Review
About us
Contact us
Refund Policy
Support
Login/Register
Collaborate
Affiliates
Affiliate Area
Privacy Policy
Terms and Conditions
Refund Policy
Payment systems accepted by Wpmet

Wpmet is not affiliated with or endorsed by Open Source Matters or the WordPress Project. The CMS logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Opt out!.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
Vendor/Partner
SAVE & ACCEPT