How To Fix "Out of Memory Size Bytes Allowed" Error in WordPress 1

How To Fix “Out of Memory Size Bytes Allowed” Error in WordPress

WordPress is the world’s most popular platform for content creation and management, especially for users with little or no coding background. But no matter how simple, sooner or later you will run into a WordPress bug. Troubleshooting for errors can vary, but most have one thing in common – you can quickly find a solution.

Fortunately, Allowed Bytes Memory Size Exhausted Error is one of those tame problems with a pretty easy and intuitive solution. The error message is: “Exhausted memory size of X bytes allowed in some file path on line/Z on your site (tried to allocate Y bytes)”, with X, Y, Z displayed as numbers.

Memory freeing error

error caused by a lack of available server memory, mostly due to overuse of plugins. We’ll show you how to fix this problem by breaking it down into a few small steps.

Resolving the Error

Due to the cause of the error, two possible solutions immediately come to mind – disabling unnecessary plugins and memory_limit parameter.

Before continuing with the troubleshooting, it is highly recommended to create a backup of your WordPress site. You can do this manually or contact your hosting provider to assist you.

Another tip before we start – wait a few minutes and try refreshing the pagejust to make sure the error is not temporary.

Disabling Plugins

Disabling plugins is the easier and faster of the two possible solutions to the problem. Set route to Plugins > Installed Plugins, find a plugin and disable it. Clear browser cache and reload the page. Repeat the process until the error is gone. We strongly recommend disabling these plugins.

However, if the error is not resolved or some plugins are too valuable to be disabled, then move on to the second solution.

Increasing Server Memory

Before we discuss ways to increase server memory, there are a few important things you should know.

First, increased memory Only possible within the limits of your hosting package. If 256M isn’t enough, using higher values ​​will likely result in 500 internal server errors. Check with your hosting provider about the change, especially if you are using shared hosting.

Second, you will need to edit the files using an FTP client to make the changes described in this guide. If you don’t feel comfortable doing this, ask your hosting provider to assist you.

Now we will show you 4 ways to increase memory_limit. After following each of the solutions below and before running the test, don’t forget to clear the browser cache.

Jump to solutions!

  1. Editing the ‌wp-config.php‌ ‌file‌

to edit wp-config.php file, Connect to the server using your FTP credentials. Go to root WordPress directory and wp-config.php file.

WP Configuration Edit

Edit the file using a text editor. Simply add the following line of code before /* That’s all, stop editing! Happy blogs. */ liner.

define( 'WP_MEMORY_LIMIT', '256M' );
Wp config memory increase

Save the changes and load the edited file to the location of the original file. This action will invalidate the old file.

  1. Editing the php.ini file

this php.ini file is also located in the root WordPress directory so you can access the file the same way. wp-config.php file.

Open the file with a text editor, memory_limit and change the value associated with it. Similarly, save the changes and override the old file with the new one.

If the file does not exist, create it and add this line of code.

memory_limit = 256M

For some shared hosts, you need to: Specify your root WordPress directory for the memory limit increase to take effect. You can do this by adding the code below to your file. .htaccess the file is near the top.

Replace “your username” with your actual cPanel username.

<IfModule mod_suphp.c> 
suPHP_ConfigPath /home/your_username/public_html
</IfModule>

Edit .htaccess file using a text editor. You can find more details about access. .htaccess The file in Chapter 4 where we describe the fourth solution to this error.

htaccess shared host editing
  1. Changing cPanel options

Another way to solve the error, change memory limit value in cPanel. Login to cPanel using your credentials, Software section and click on “MultiPHP INI Editor”.

cPanel editing

Select your domain from the drop-down list, look for the “memory_limit” attribute and enter 256M as the corresponding value.

cPanel edit php.ini image-1
cPanel edit php
  1. Editing the .htaccess file

Finally, you can fix the error by editing it. .htaccess file. This file is also located in the root WordPress directory. This is a server configuration file and is usually hidden..

To access it, you must enable the corresponding option(s) to show hidden files in the FTP client of your choice. If you’re using FileZilla, like we did, go to the Server tab and click the “Force show hidden files” option.

Show hidden files image

Connect to the server using your FTP credentials, navigate to the root WordPress directory and .htaccess file.

htaccess editing

open the file, Search for “memory_limit” and change the value associated with. Save the changes and override the old file with the new one.

If there is no existing code, add this line.

php_value memory_limit 256M
htaccess memory limit increase

final thoughts

It only takes a few minutes to use any of these methods to fix the Allowed Bytes Memory Size Out Error. In addition to showing you how to fix this problem, we have also tried to shed some light on the sources of this problem. With this guide, you will not only be better equipped to deal with unexpected errors, but you will also be more knowledgeable about the way your website works.

Support our work ❤️

If you enjoyed this article, consider leaving a tip to help us keep publishing great content.

Secure payment on PayPal
Moyens I/O Staff is a team of expert writers passionate about technology, innovation, and digital trends. With strong expertise in AI, mobile apps, gaming, and digital culture, we produce accurate, verified, and valuable content. Our mission: to provide reliable and clear information to help you navigate the ever-evolving digital world. Discover what our readers say on Trustpilot.