How to Increase WordPress PHP Memory Limit

If you want to increase your PHP memory limit for any reason, I will show you exactly how I did that on my Sitegrounds-hosted WordPress website.

Spread the love

So if you’re getting a memory limit error on your WordPress dashboard, I will show you how to fix that right now. This method includes going into your cPanel. I’ll be doing it with HostGator because that’s my hosting provider. But if you have something else, I’m sure it’ll probably work the same way. 

The problem I’m having is that the current memory limit is set to 40 megabytes, and I want to increase that because, on this particular website, I’m going to be using a couple of plug-ins that require a lot more memory. 

How to fix memory limit error on WordPress

This involves going into your website’s back end and editing some custom code. If you don’t feel comfortable with that, maybe this isn’t for you, but it’s simple. It’s just copy-paste, and I’ll provide the code in the description. So you shouldn’t have a problem. Just paste it in the same place that I put it. 

  1. Access your cPanel

    First, go to your HostGator account. You could log in straight to the cPanel, but I always log into the hosting portal. 

  2. Find the website you need to fix

    From this point, you’re going to want to click File Manager. Here’s a list of our websites. We’re going to look for the particular website we’re trying to increase memory on. 

  3. Located wp-config

    Locate the WP config file, right-click it, and click Edit. (If you double-click WP config instead of right-clicking and go into edit, it’s not going to open the file, it’s just going to download it to your downloads folder.) Next, you will see some PHP code. It can look intimidating but don’t worry, don’t mess with anything else here. Just do what we’re going to do, and you should be fine. 

  4. Paste this code

    Now, go down to the right where it says “MySQL Settings,” and paste this code:

    define( ‘WP_MEMORY_LIMIT’, ‘128m’ );

    That’s all we have to do.  Now click Save, and the alert should go away. Now you can use those plug-ins that use a little bit more memory. 

Reasons why your code might not be working

There are a few reasons why your code might not be working.

Yerain abreu seo increase wordpress php memory limit thumbnail.
Yerain abreu seo increase wordpress php memory limit thumbnail.

1. You have a syntax error

If you see a red x on the code page, it means the code syntax is not written correctly and will not work; it might end up crashing your entire website. So if you see an X there, that means you typed something wrong. Check that you didn’t put a comma where it shouldn’t be. 

2. You are missing a comma

Another reason for this code not working is that you are missing a comma. You might have found the code from somewhere else on the internet,  maybe Stack Overflow or some other website, but when you grabbed it and tasted it exactly, the original poster was missing the comma.

3. You are missing a semicolon

Another reason you might experience trouble is if you are missing a semicolon at the end of the code. That’s a big one because it’ll make something else not work correctly and break your code altogether. So remember to add the semicolon.

Are you a visual learner? Check out my video below titled “How to Increase Maximum PHP Memory Limit and Remove Limit Error on WordPress from cPanel” from my YouTube channel, as I show you all this firsthand.

A video titled How to Increase Maximum PHP Memory Limit and Remove Limit Error on WordPress from cPanel‘ from the Yerain Abreu YouTube channel.

Frequently asked questions (FAQ)

Do you still have questions? Below are some of the most commonly asked questions about fixing WordPress issues.

What is PHP used for?

PHP is an open-source server-side programming language that many web developers utilize. It is also a general-purpose programming language that can create various applications, including Graphical User Interfaces (GUIs).

How do I check the PHP memory limit in WordPress?

You can quickly check your PHP memory limit by clicking on Tools > Site Health > Info in your WordPress dashboard. Then, search the Server tab for the PHP memory limit item.

Does PHP 8 use more memory?

WordPress memory use was roughly 2-8 MB with PHP 7.4 and before. WP memory use increased to more than 28-30 MB after upgrading to PHP 8.1. Because the (default) WP memory limit is 40 MB, 30 MB is now very near the limit.

Conclusion

Okay, so that concludes this video. What do you think? Let me know in the comments below (I read and reply to every comment). If you found this article helpful, check out my full blog and subscribe to my YouTube channel. Thanks for reading!

Leave a Comment

Frequently asked questions (FAQ)

LiaisonLabs is your local partner for SEO & digital marketing services in Mount Vernon, Washington. Here are some answers to the most frequently asked questions about our SEO services.

SEO (Search Engine Optimization) is the process of improving your website's visibility in search engines like Google. When potential customers in Mount Vernon or Skagit County search for your products or services, SEO helps your business appear at the top of search results. This drives more qualified traffic to your website—people who are actively looking for what you offer. For local businesses, effective SEO means more phone calls, more foot traffic, and more revenue without paying for every click like traditional advertising.

A local SEO partner understands the unique market dynamics of Skagit Valley and the Pacific Northwest. We know the seasonal patterns that affect local businesses, from tulip festival tourism to agricultural cycles. Local expertise means we understand which keywords your neighbors are searching, which directories matter for your industry, and how to position your business against local competitors. Plus, we're available for in-person meetings and truly invested in the success of our Mount Vernon business community.

SEO is a long-term investment, and most businesses begin seeing meaningful results within 3 to 6 months. Some quick wins—like optimizing your Google Business Profile or fixing technical issues—can show improvements within weeks. However, building sustainable rankings that drive consistent traffic takes time. The good news? Unlike paid advertising that stops the moment you stop paying, SEO results compound over time. The work we do today continues delivering value for months and years to come.

SEO pricing varies based on your goals, competition, and current website health. Local SEO packages for small businesses typically range from $500 to $2,500 per month, while more comprehensive campaigns for competitive industries may require a larger investment. We offer customized proposals based on a thorough audit of your website and competitive landscape. During your free consultation, we'll discuss your budget and create a strategy that delivers measurable ROI—because effective SEO should pay for itself through increased revenue.

Both aim to improve search visibility, but the focus differs significantly. Local SEO targets customers in a specific geographic area—like Mount Vernon, Burlington, Anacortes, or greater Skagit County. It emphasizes Google Business Profile optimization, local citations, reviews, and location-based keywords. Traditional SEO focuses on broader, often national rankings and prioritizes content marketing, backlink building, and technical optimization. Most Mount Vernon businesses benefit from a local-first strategy, though many of our clients combine both approaches to capture customers at every stage of their search journey.

Absolutely! SEO and paid advertising work best as complementary strategies. Google Ads deliver immediate visibility and are great for testing keywords and driving quick traffic. SEO builds sustainable, long-term visibility that doesn't require ongoing ad spend. Together, they create a powerful combination—ads capture immediate demand while SEO builds your organic presence over time. Many of our Mount Vernon clients find that strong SEO actually improves their ad performance by increasing Quality Scores and reducing cost-per-click, ultimately lowering their total marketing costs while increasing results.