5/5 - (2 votes)

Are you struggling to troubleshoot a Fatal error allowed memory size of 67108864 bytes exhausted? If so, you’re not alone! This is a common issue for developers and webmasters. In this blog post, we’ll show you how to quickly and easily resolve this issue. Read on to get the details.

Why did you get “Fatal error allowed memory size of 67108864 bytes exhausted”

The “Fatal error: Allowed memory size of 67108864 bytes exhausted” message indicates that your PHP script has exhausted the memory limit allocated to it by your server. This can happen when the script requires more memory than the specified limit to complete its task, causing it to crash and display an error message.

By default, the memory limit for most PHP installations is 64 MB, but it can be increased or decreased depending on the needs of the script. To resolve this issue, you can either increase the memory limit in your PHP configuration file or optimize the script to reduce its memory usage.

Fatal Error Allowed Memory Size Error

In today’s tutorial, we will provide you with some useful solutions to help you increase the PHP memory limit for your server. Let’s check them out.

How to handle the “Fatal error allowed memory size of 67108864 bytes exhausted” error

There are numerous methods to tackle this error. Here are some useful solutions that you can apply to eliminate this error. Now, let’s check them out.

Solution 1: Increase the PHP memory limit.

By increasing the memory limit, you are allowing the PHP script to allocate more memory, which can help it complete its task without crashing. However, it’s important to note that increasing the memory limit may not always be the best solution, as it can also lead to other problems, such as slow performance or reduced stability on the server.

Now, to increase the PHP memory limit, you need to access WordPress files on the web server by using File Manager in Cpanel or an FTP client. Here is a step-by-step guide to complete this task.

  1. Locate the PHP configuration file: The PHP configuration file is often named php.ini including the memory limit. The location of this file will depend on your server setup, but it’s often located in the /etc/ or /usr/local/etc/ directory.
  2. Open the PHP configuration file: You can open the php.ini file using a text editor such as nano or vi.
  3. Locate the memory_limit setting: Look for the line memory_limit = X, where X is the current memory limit.
  4. Increase the memory limit: Change the value of memory_limit to a higher value, such as 128M or 256M.
  5. Save and close the file: After making the changes, save the file and close the text editor.
  6. Restart the web server: To apply the changes, you’ll need to restart your web server. The method for restarting the web server will depend on your setup, but it can often be done using the command sudo service apache2 restart or sudo service nginx restart.
  7. Test the change: To confirm that the memory limit has been increased, you can create a new PHP script with the following code: <?php echo ini_get("memory_limit"); ?>, and run it on the server. The script should display the new memory limit value.

Solution 2: Edit your .htaccess file

The .htaccess file is a server configuration file that can be used to control various settings for the website, including the PHP memory limit. Here’s how you can increase the memory limit by editing your the .htaccess file:

  • Let’s open your file manager
  • Locate the .htaccess file: The .htaccess file is typically located in the root directory of your website.
  • Open the .htaccess file: You can open the .htaccess file using a text editor such as nano or vi.
  • Add the following line of code to the file:

php_value memory_limit 256M

This line of code sets the memory limit to 256 MB.

  • Save and close the file: After making the changes, save the file and close the text editor.

Solution 3: Deactive and reactive all plugins

Deactivating and reactivating all plugins in your WordPress website may not directly resolve the “Fatal error allowed memory size of 67108864 bytes exhausted” error.

However, in some cases, a plugin that’s installed on your WordPress website can consume a large amount of memory, leading to a memory limit error. By deactivating and reactivating all plugins, you may be able to identify the plugin that’s causing the problem, and either optimize or remove it to resolve the issue.

To do that, first of all, you need to deactivate all plugins and then reactivate them one by one to find the cause.

Here’s how you can do it:

  1. Connect to your server using FTP or SFTP.
  2. Navigate to the wp-content directory.
  3. Rename the plugins directory to plugins_old. This will temporarily disable all plugins in your WordPress installation.
  4. Try accessing the WordPress dashboard again. If the error is resolved, you’ve successfully identified a plugin that was causing the issue.
  5. To reactivate the plugins, rename the plugins_old directory back to plugins.
  6. To determine which plugin was causing the issue, reactivate the plugins one by one, checking the WordPress dashboard after each activation to see if the memory limit error reoccurs.

If the error persists after disabling the plugins, you may need to increase the PHP memory limit as described in our previous solutions or optimize the code of your WordPress website to reduce its memory usage.

The bottom line

“Fatal error: Allowed memory size of 67108864 bytes exhausted” is a common WordPress error that can be solved by increasing the memory limit. Hopefully, via our blog, you can know how to troubleshoot and solve this issue effectively. If your error doesn’t disappear, let’s leave a comment below. We will support you soon.

Further, don’t forget to follow our website to regularly update new troubleshooting blogs. By the way, visiting our website is a great chance to discover tons of stunning, free WordPress Themes.

Leave a Reply

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

Summer Sale Get 50% OFF for your purchase on today! Coupon code: SUMMER2024 Redeem Now
Summer Sale Get 50% OFF for your purchase on today! Coupon code: SUMMER2024 Redeem Now