blog

Fix “There Has Been a Critical Error” Caused by Memory Limits

If you’ve seen the dreaded message “There Has Been a Critical Error on This Website”, don’t panic. You’re not alone. This can happen to many WordPress users, especially after installing a new theme or plugin. One of the most common reasons? A PHP memory limit that’s way too low.

But don’t worry. We’ll walk you through how to fix it, step by step. No need to be a coding wizard. Let’s keep it simple, a little fun, and totally doable—even for beginners.

🧠 What Does “Critical Error” Really Mean?

This error just means your site crashed. It’s like a computer having a brain freeze. WordPress tried to run something, like a big plugin or theme function, but ran out of memory.

[p-ai-img]computer crash frustrated person wordpress[/ai-img]

This usually happens when your hosting account doesn’t give WordPress enough PHP memory to get the job done. So, think of PHP memory as your website’s brainpower. Too little? Crash land.

📏 What Is PHP Memory Limit?

PHP memory limit is the amount of memory a script can use. WordPress needs this memory to run themes, plugins, and core files. If it’s too low, boom—critical error!

Common default limits:

  • 32 MB – Very Low (Trouble ahead!)
  • 64 MB – Still pretty low
  • 128 MB – Better
  • 256 MB – Ideal for larger sites with big plugins

🔧 How to Fix the Critical Error (By Boosting Memory)

Let’s roll up our sleeves and increase that memory. You can do this in several ways. Choose the one that’s easiest for you.

1. Edit wp-config.php (The Easiest Way)

Here’s how to do it:

  1. Access your site files via FTP or File Manager in cPanel.
  2. Find the file called wp-config.php.
  3. Back it up (just in case).
  4. Open the file and scroll down until you see /* That's all, stop editing! Happy blogging. */
  5. Add the following line above that comment:
define('WP_MEMORY_LIMIT', '256M');

Save and close the file. Then check your site. It might load like a charm now!

2. Use .htaccess File (For Apache Servers)

If you’re using an Apache server, you can boost PHP memory in the .htaccess file:

  1. Open your site’s root folder.
  2. Find the .htaccess file and back it up first.
  3. Add this line to the bottom:
php_value memory_limit 256M

Save the changes and reload your site. If you’re lucky, the error will be gone!

3. Update php.ini File (Advanced but Powerful)

If you have access to the php.ini file (usually in VPS or dedicated hosting), here’s what to do:

  1. Locate the php.ini file in your root folder or ask your host where it is.
  2. Open the file and look for memory_limit.
  3. Change it to:
memory_limit = 256M

If the line doesn’t exist, add it yourself! Save it and restart your web server if needed.

4. Talk to Your Host (The “I Don’t Wanna Do Tech” Way)

Not comfy editing code or files?

No problem! Just reach out to your web host’s support. Ask them to increase your PHP memory limit to 256M. They can usually do this within minutes.

🤔 Did the Error Go Away?

If your site is back up, congrats! 🎉 Give yourself a high five. You boosted your memory and saved your site.

[p-ai-img]happy person laptop working wordpress success[/ai-img]

If the error is still there, don’t despair. There might be other issues at play.

🧹 Other Things You Can Try

If bumping up memory didn’t fix it completely, here are a few more things to check:

  • Disable problem plugins – Log in via FTP and rename the plugins folder to plugins-deactivated. This turns off all plugins at once.
  • Switch to default theme – Rename your current theme folder and WordPress will revert to a default one like Twenty Twenty-Three.
  • Check error logs – Ask your host or check error_log in your directory. Sometimes it shows exactly which file or function crashed.

Memory was just one possible cause. You might have a buggy plugin or a misconfigured theme.

🛡️ How to Prevent This in the Future

Now that you’ve fixed it, let’s make sure it never happens again—or at least, not anytime soon.

  • Keep regular backups of your site. Use plugins like UpdraftPlus or Jetpack Backup.
  • Update plugins and themes regularly and only use reputable ones.
  • Avoid overcrowding plugins. More isn’t always better.
  • Increase memory limit permanently to at least 256M ahead of time.
  • Use good hosting. Shared hosting often gives limited resources. Consider upgrading to managed WordPress hosting or VPS.

🛠️ Tools That Can Help

If you want to monitor things more closely, try these tools:

  • Query Monitor: Great for spotting heavy plugins and slow queries.
  • Health Check & Troubleshooting: Built by the WP community. Handy for diagnosing errors.
  • WP Debugging: Helps enable WP debug mode to catch problems earlier.

🚀 Final Thoughts

Fixing the “There Has Been a Critical Error” message can feel scary. But most of the time, it’s a simple fix—just crank up your site’s memory!

You don’t need to be a pro coder or tech guru. Just follow the steps, take backups, and take it slow. Your website wants to work—it just needs a little tune-up now and then.

So go ahead, give your website the memory it deserves. No more brain freezes!

And remember—next time your site acts up, you’re more prepared than ever before. High five! 🖐️