What caused “Fatal error:Allowed memory size of 67108864 bytes exhausted”
“Fatal error:Allowed memory size of 67108864 bytes exhausted” is considered one of the popular errors frequently encountered by the majority of WordPress users, especially when using shared hosting services. If you get the error “Fatal error: Allowed memory size of x bytes exhausted” which means that your web server is limited to the maximum amount of memory allowed by your website or your plugins have consumed too much memory storage.
To sum up, this error will occur when the WordPress system or your current plugins take up too much memory of your server. As a result, once the server runs out of memory allocated to your website, PHP will trigger the “allowed memory size exhausted” error.
So, to handle this error, you only need to increase the PHP memory limit for your server. In today’s blog, we will give you a step-by-step tutorial to help you easily achieve it. Now, let’s check it out.
How to fix “Fatal error:Allowed memory size of 67108864 bytes exhausted”
Method 1: Increase PHP memory limit
In order 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. In our case, we are going to use File Manager.
Step 1: Log in to Cpanel
Step 2: Let’s open File Manager and locate the Public_html folder.
Step 3: Look for the WP-config.php file and then right-click and choose the “Edit” option.
Step 4: Add the following code before the line “That’s all, stop editing! Happy blogging”
define ( ‘WP_MEMORY_LIMIT’, ‘256M’);
This code will help increase the PHP memory limit up to 256MB.
Step 5: Click on the “Save Change” button and reload your website to check if the error is gone.
Method 2: Edit your .htaccess file
If you don’t have access to php.ini, you can edit your .htaccess file by implementing the following steps:
Step 1: Open your file manager.
Step 2: Locate the .htaccess file in the public_html directory
Step 3: Right-click and select Edit
Step 4: Add the following code to a .htaccess file
php_value memory_limit 64M
Don’t forget to save your changes and check if the error is handled.
Method 3: Deactivate and reactivate all plugins
Increasing the PHP memory limit will certainly help you fix memory exhaustion. However, you also need to check all your installed plugins on your website. Since they are also the major reason causing this error.
To do that, first of all, you need to deactivate all plugins and then reactivate them one by one to find the cause.
However, you are not able to access the WordPress dashboard, so you need to disable the plugins from the server.
Step 1: You need to login to Cpanel and open File Manager again
Step 2: Open the wp-content folder and find the plugins folder
Step 3: Rename the “plugins” folder into any something. For example plugins-error. Don’t worry, because this change will not affect your plugins.
Step 4: You need to create an empty folder and name it “plugins”
This process will help you automatically disable all installed plugins on your WP site. Now, you can reload your website to check the error is fixed. If your site is running again, then you can conclude the error could have been caused by one of your installed plugins.
Step 5: Now, you need to go back to the wp-content folder to remove the empty folder created earlier. Then rename the plugins-error folder back to “plugins“. This will restore all your plugins on your website without reactivating them.
Step 6: You can log in to the WP dashboard and go to the Plugins page to activate all plugins one by one to see which one is causing the error.
If you get the error again, which means that the error will be caused by the last plugin you just reactivated.
Method 4: Seek professional support
If you have tried all mentioned solutions, but the error still doesn’t go away. In this case, the error can be caused by your server, you need to contact the technical support of your web hosting provider to ask for support. If you get the same error, you can consider upgrading your hosting to have an advanced hosting service with large memory.
We have just provided three methods to fix the error “Fatal error:Allowed memory size of 67108864 bytes exhausted”. Hopefully, you can try one of them to tackle your problem. If your trouble is not fixed, please leave a comment below. We will support you as soon as possible. Don’t forget to share this post with those who have the same error as you.
Moreover, you can drop by our Free WordPress Themes to explore plenty of easy-to-use, responsive, delightful designs. They will help you easily achieve your desired websites.
- List Of 5+ Best Woocommerce Digital Product Plugins - November 14, 2023
- 15 Best Education WordPress Themes in 2023 with Fully Responsive Layouts - November 14, 2023
- Best WordPress Black Friday & Cyber Monday Deals (Up to 90% off) - November 6, 2023