How to Increase the PHP Memory Limit in WordPress

Updated on Jul 8, 2019

If you see an “allowed memory size exhausted” error in WordPress, you should know that it's one of the most commonly seen WordPress errors. Not to worry, you can quickly fix it by increasing the PHP memory limit. We will give you a hand with resolving the problem.

In this post, you will find:

About WordPress Memory Limit

WordPress is written in PHP, which is a server-side programming language. Every website needs a WordPress hosting server for it to function correctly. Web servers are actually like any other computer. They need to have the memory to run multiple applications efficiently at the same time. Server administrators allocate specific memory size to different applications, including PHP.

When your WordPress code requires more memory than the default allocated memory, you get this error:

Fatal error

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

By default, WordPress will automatically try to increase the PHP memory limit if it's less than 64MB. However, 64MB often is not nearly enough. With that said, let us see how to address the PHP memory limit in WordPress to avoid the memory exhausted error.

Adjusting the PHP Memory Limit in WordPress

There are three ways to address the memory limit:

You can change the memory limit via the PHP Selector in cPanel

  • With our shared hosting plans you have full control, and you can easily configure specific PHP setup for your account. This can be achieved via cPanel, so you do not need to contact the Support team for that. In order to change the memory_limit and upload_max_filesize values, you need to access your cPanel account first;
  • Locate the Software and Services section on the page and click on Select PHP Version. At the top right corner of the screen, you will notice a button named Switch To PHP Settings. Go to that page, and you will be able to change the memory_limit and upload_max_filesize values to the ones you need for your application;
  • When you complete the change, click on the Save button on the left bottom corner of the page and the system will do the rest. Open your website, and you will be able to use the new configuration of your account.

You can increase the memory limit of the application

  • Many WordPress themes and plugins that require the memory limit of the application to be increased. How can this be achieved? It is relatively easy, and all you have to do is locate the wp-config.php file and add the following line:
define ('WP_MEMORY_LIMIT', '64M');
  • Also, if you have access to your php.ini file, you can add or change this line:
memory_limit = 64M;

Notice that in both of the examples, we have used 64 MB as value for the memory limit. However, you should set the value that the theme/plugin requires. Also, those changes can be performed via the cPanel or the FTP service.

Contact us for Assistance

In case you tried both ways, and they don't work, or if you simply don't have the time to address the issue on your own, feel free to submit a ticket via your Client Area with us. If you are not yet our client, you can check our WordPress Hosting packages so you can enjoy the improved speed, advanced security, and expert technical support services it offers.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

WordPress Hosting

  • Free WordPress Installation
  • 24/7 WordPress Support
  • Free Domain Transfer
  • Hack-free Protection
  • Fast SSD Storage
  • Free WordPress Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More