Loading...

Knowledge Base
Up to 75% off on hosting for WordPress websites and online stores

WordPress Fatal error: Allowed memory size exhausted

It is a very frustrating yet common error faced when encountering the "Allowed memory size exhausted" problem in WordPress. This guide will get you through steps to increase your PHP memory limit and troubleshoot your error so that your WordPress site runs smoothly.

Memory Allocation and Exhaustion Problems Within WordPress Installations

By default, our servers allow up to 32MB of data to be transferred via PHP. Not having enough memory can result in errors that look similar to this one:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2515174 bytes) in /path/to/WordPress/file.php on line 1331 

Before we get started, it is important to understand which of the three PHP settings you are using for your hosting account. Please see PHP Configuration to learn how to check your PHP settings.

Using PHP8.1 Single php.ini or PHP8.3 FastCGI Locate the php.ini file in public_html, then copy from standard PHP 8.1 to 8.3 to copy the php.ini before and then copy it into wp-includes/ or created by PHP Config icon in the cpanel and renamed to: php.ini. This will ensure the file works correctly.

Important: PHP version 8.1 is the lowest PHP version available on our Shared hosting servers.

You need to alter the value of "memory_limit," and for that, you have to open your php.ini file with a text editor like "Edit" or "Code Edit" in your Bluehost File Manager. When the file opens, use Ctrl+F to find the memory_limit setting, which looks something like this:

 memory_limit = 256M  ; Maximum amount of memory a script may consume (256MB)

Update this number to allow more memory. We suggest leaving it at "64M," which is the usual requirement. Save your files. You would then look for wp-settings.php - where WordPress is installed - to open. In the document, you will find:

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

Adjust this value to reflect the new memory limit. Save the changes to the file. Once saved, the changes should take effect immediately.

Note: To confirm that your memory_limit has been updated correctly, create a text file named info.php in the same directory you edited this new php.ini file with. Create this new text file and add the following code:

<?php phpinfo() ;?>

Then open the page in a browser, and ensure that you include the directory name in the URL if you put the info.php file, memory_limit, etc. PHP settings should have now changed; this will also show you the path to the php.ini file which is being used.

Summary

All things considered, the "Allowed memory size exhausted" WordPress error is manageable if all the proper steps are done. Through BRAND's guide that will make the PHP memory limit increase in your WordPress and optimizing all the resources of your website, you will be successfully out of this issue.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Did you find this article helpful?

 
* Your feedback is too short

Loading...