Meet Our New Innovation

Grab It at Flat 50% OFF

How To Change PHP Memory Limit WordPress

How To Increase PHP Memory Limit in WordPress

Let’s say you are trying to install a WordPress plugin or add PHP files to your website. But your website fails to load and shows a fatal error message which tells you that “You don’t have enough memory.”

However, you don’t have any idea why it happens and how to solve this problem in the right way.

Don’t worry you are not the only one who faces this issue.

So, in the following guide, we are going to let you know how you can change the PHP memory limit in your WordPress website which will solve the issue. Before that let’s understand what is the PHP memory limit and what is the reason for the memory exhausted error.

Let’s get started.

What Is PHP Memory Limit and Why WordPress Memory Exhausted Error Occur

Your website works with a hosting server. Like a computer, your website uses your server’s RAM. That means every file and script on your website uses server memory.

The PHP memory limit allocates the maximum amount of memory for your website applications. If your website has a lot of programs, that means your server uses more memory to load your site.

By default, WordPress sets the PHP memory limit of 32MB but some web hosting providers increase this to 64MB for all users. However, the default memory limit (32MB) is fair enough for a website that has a few pages and a limited number of media files or small size plugins.

But if you want to build an eCommerce website or want to use a page builder like Elementor to design your website then you have to increase the memory limit. Because those large-sized plugins need more memory to function.

If you do not take the necessary steps to improve the memory limit then your website is unable to load. And show you an error message that is called the WordPress Memory Exhausted Error.

Here, we’ve tried to install the WooCoommerce plugin.

Install WooCommerce Plugin

But got an error message because of the PHP memory limit.

Memory exhausted error displayed on a WordPress site
WordPress Memory Exhausted Error (Source: WPBeginner)

If you see this error, you should take the proper steps to resolve this issue.

In the following part of our guide, we will show you how to fix the problem.

Increase PHP Memory Limit in WordPress(2 Ways)

What Is PHP Memory Limit and Why WordPress Memory Exhausted Error Occur

Now it’s time to show your how to increase the PHP memory limit in two simple ways.

  1. Using FTP Server
  2. Using cPanel

You can follow any of the options according to your need.

Method 1: Increase PHP Memory Limit Via FTP

To improve the PHP memory limit of your website, you need to edit your wp-config.php file. You can easily access your wp-config.php using an FTP server like FileZilla. It’s free so you can download and use it to access your website backend files.

Learn what is an FTP server and how does it work.

After finishing the FileZilla setup, you can connect your website to it. Then you just need to find and open the wp-config.php file.

Use FileZilla to get wp-config file
Source: Kinsta

Now it’s time to add the below code snippet to the wp-config.php file (paste it at the end of the code).

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

Don’t forget to save the file after editing.

Now you have defined your website PHP Memory Limit 256MB. That is perfect for all websites.

Note: You are able to increase the memory limit to 512MB based on your need.

Method 2: Increase PHP Memory Limit Via cPanel

You can also edit the wp-config.php file using your cPanel. First, log in to your cPanel account using the right credential.

Then navigate to the public_html->yourwerbsite->wp-config.php.

Like the above way, you need to paste the code again.

define( 'WP_MEMORY_LIMIT', '256M' );
Edit wp-config file
Edit wp-config.php file

Then save the file.

Now you see that we have successfully installed the WooCommerce plugin without facing any WordPress Memory Exhausted Error.

Install & Active WooCommerce Plugin

That’s it.

Check more: WordPress website maintenance checklists.


It is not necessary for all WordPress websites to increase their PHP memory limit from 32MB to 256MB. If your website has a lot of heavy files and extra plugins that cross the default memory then you should increase it.

Some hosting providers do not allow you to increase the PHP memory limit. If it happens, you should contact your hosting provider to resolve this issue.

There are some other common WordPress errors that can also prevent your website from loading. You can check and fix them by reading the below article.

Learn: How to Solve WordPress Website Not Loading Issues

If you like this helpful guide don’t forget to share this blog on your social channels. You can also join our newsletter to get helpful WordPress & Elementor guides for free.

Subscribe to our newsletter

Get latest news & updates on Elementor

Share this post

Related Post

Leave a Reply

Your email address will not be published.

🤔 Are you sure? Price increases in… 👇