How to Easily Fix WordPress Memory Exhausted Error

Wordpress Memory Exhausted Error

Do you ever run into the WordPress Memory Exhausted Error while installing a premium WordPress theme or plugin? If yes, then you need to read this guide.

What Is WordPress Memory Exhausted Error?

When you are on a shared server, your web hosting provider allocates a very low PHP memory to your account by default, and because PHP is the core language of WordPress and nearly all WordPress plugins and themes are written in PHP, so they need memory to run efficiently.

When your theme or plugin requires more memory then the default allocated memory, then you get an error similar to this.

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/example/wp-includes/plugin.php on line 356

Wordpress Memory Exhausted Error
WordPress Memory Exhausted Error

WordPress memory exhausted error is one of the most common WordPress problem, and it happens so frequently because by default PHP memory limits are set to very low if you’re on a shared hosting server.

How to Increase PHP Memory Limit in WordPress?

There are many ways to increase the PHP memory limit in WordPress, like creating a php.ini file, editing the wp-config.php file, editing the .htaccess file or installing a plugin that will increase PHP memory for you.

I prefer creating a php.ini file to increase the PHP memory limit because it’s the safest of all, you might think installing a plugin is the easiest, but it’s not the safest, because an extra plugin can slow down your WordPress site a little bit, and may risk your website security too if it’s not regularly updated and maintained.

That’s why I always try to avoid an extra plugin when it’s possible.

I would also avoid editing the .htaccess file or wp-config file when it’s possible, so that’s why I prefer creating a php.ini file to fix the WordPress memory exhausted error.

And in this tutorial, I’,m going to show you how to create a php.ini file and use it to fix the WordPress memory exhausted error.

So, let’s get started to create a php.ini file to increase the PHP memory limit and fix WordPress memory exhausted error.

1 Create a php.ini file in the WordPress root directory to increase PHP Memory Limit

You can easily create a php.ini file in your cPanel > File Manager.

1.1 Go to your WordPress root directory from File Manager (click on public_html and select your domain if you’ve more than one WordPress sites, otherwise public_html is your root directory) and do steps listed below. (Match steps with screenshot listed below steps)

  1. Click on + icon on the top left which says “File” to create a file (a popup box will open).
  2. Write php.ini in “New File Name” and click on the “Create New File” button.
  3. Select the php.ini file, you recently created, and click on the “Edit” menu from the top menu list and it will open the php.ini file in a new browser.
Creating Php.ini File In Wordpress Root Directory Using File Manager
Creating a php.ini file in the WordPress root directory using File Manager

1.2 Add the following line of code in your php.ini file and click save, and BOOM, your WordPress Memory Exhausted Error should be gone after completing step 4.

memory_limit = 256M; 

Above line of code will increase the PHP memory limit to 256M and In most cases, a memory limit of 256M will work fine, but if still face the same problem while installing a plugin or theme, then you can increase memory limit from 256M to 512M.

If your WordPress theme or plugin is too heavy and your WordPress dashboard doesn’t let you upload it either, then you should also increase “Maximum Upload Limit of Filesize”, and to do that, add following line of code in your php.ini below the first line of code.

upload_max_filesize = 256M;

You can also increase your “Maximum Upload Limit of Filesize” from 256M to 512M if WordPress still doesn’t allow you to upload WordPress theme or plugin because it’s file size is very big.

Also Read: How to Setup a Free SSL in WordPress

I hope this article helped you, but if you face any trouble, you can ask me in the comments section below or contact me directly, and I’d be more than happy to guide you through the process. 🙂

If you liked this article, please share it with your friends and subscribe to the How-To WP Newsletter below to get the latest WordPress tips, tricks, and how-to tutorials directly into your inbox.

Frequently Asked Questions (FAQs)

Is WordPress blog free?

WordPress.com is free and requires no financial investment for you to start your business. WordPress.org, on the other hand, is a self-hosted platform that requires hosting.

How bloggers get paid?

Bloggers get paid by having a revenue-sharing agreement with the website they’re writing for. It’s usually a percentage of the advertising revenue generated by the website especially using Google Adsense. Sometimes they’ll be paid a flat rate for writing a specific number of articles or posts.

How difficult is WordPress?

For years, WordPress has been the go-to blog publishing system. However, many people don’t know that it is also one of the easiest to install, update, and customize. If you’ve been looking for an easy way to start a blog or website and you’re comfortable with the idea of using WordPress, you’re in luck.

What blogs make the most money?

The blogs that make the most money belong to the following niches: finance, online education, insurance, legal, and marketing, and advertising.

Related Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our Monthly Newsletter

Get monthly updates of WordPress tips, tricks, and tutorials in your email.

Thanks. You have successfully subscribed.

Pin It on Pinterest