Running into the “Fatal error allowed memory size of 67108864 bytes exhausted” message can be a notable hindrance for developers and website administrators. Fortunately, this blog post will arm you with several remedies to help you restore your application’s smooth operation. Let’s check it out now!
Why does the “Fatal error allowed memory size of 67108864 bytes exhausted” occur?
The “Fatal error Allowed memory size of 67108864 bytes exhausted” error occurs when a PHP script attempts to allocate more memory than the limit set in the PHP configuration. There are several factors that can cause this error:
- Insufficient Memory Limit: The default memory limit in PHP is often set to a relatively low value, such as 64 megabytes (67108864 bytes). If your script requires more memory to execute, it may exceed this limit and trigger the error.
- Third-Party Libraries or Plugins: If your script relies on external libraries or plugins, it might have memory-intensive operations or memory leaks. In such cases, the error may be caused by the third-party code rather than your own.
- Server Configuration: The memory limit can be set by the server administrator or hosting provider. If the memory limit is set too low, it can trigger the error even for relatively small scripts.
4 Ways to fix “Fatal error allowed memory size of 67108864 bytes exhausted”
Increase PHP Memory Limit
One efficient solution to improve the performance of your PHP installations is to increase the memory limit. This can be accomplished by modifying the memory_limit directive in the php.ini file. To do this, locate the file used by your PHP installation (generally found in the server’s configuration directory) and open it with a text editor.
Subsequently, you must locate the line starting with memory_limit, after which you are able to adjust the value to one higher than currently set, such as 128M (128 megabytes). When the modifications are complete, remember to save your changes and restart the web server for the changes to take effect.
Modify .htaccess File
The first step you need to do is open your file manager, then find the .htaccess file in the public_html directory. After that, simply right-click and choose the Edit option. Now, you just need to add the code below to the .htaccess file:
php_value memory_limit 64M
Deactivate and then reactivate all plugins
You can also fix the “Fatal error Allowed memory size of 67108864 bytes exhausted” by trying to deactivate and then reactivate all plugins you installed on your site.
First of all, it’s necessary for you to log in to the CPanel, then access File Manager. The next step is open the wp-content folder, and seek the plugins folder. Now, rename the folder titled “plugins” to a different name; for instance, “plugins-error.” Rest assured, this modification will have no impact on your plugins.
After that, it’s time for you to generate an empty folder and name it “plugins“. This process will enable you to deactivate all of the plugins installed on your WP website. Once this action has been completed, reload your website to ensure the error is resolved. Upon successful reloading, you can deduce that a plugin was likely the source of the error.
Return to the wp-content directory and rename the plugins-error folder to its original name, “plugins“. This will revert back to your existing plugin collection without reactivating them. Log in to the WP dashboard, navigate to the Plugins page and activate each plugin, one at a time, to identify the source of the error.
Find professional support
If none of the proposed solutions prove effective, the issue may be due to your server. If this is the case, we suggest that you contact the technical support team of your web hosting provider to troubleshoot the issue. If the error persists, you could investigate upgrading your hosting plan to have access to more advanced services with greater memory allocations.
The “Fatal error Allowed memory size of 67108864 bytes exhausted” error can be frustrating, but it’s not insurmountable. By following the solutions outlined in this blog post, you should be able to resolve the issue and prevent memory-related errors in your PHP applications.
If you have any questions, please leave your comment below. Furthermore, don’t forget to access our responsive free WordPress themes here.