How to fix :fatal error: allowed memory size of 41943040 bytes exhausted in WordPress
The fatal error: allowed memory size of 41943040 bytes exhausted is one of the most prevalent problems faced by WordPress users, especially those who utilize shared hosting plans. In case you are facing this error, it means your server is limiting the amount of memory your website can utilize, or a plugin is eating too much server memory. Hence, in this article, Arrowtheme will give you a comprehensive guide to fix this problem in just some simple steps. Then, explore with us right now!
What causes the Fatal error: allowed memory size of 41943040 bytes exhausted?
In general, WordPress mainly relies on PHP code and scripts. To put it plainly, PHP is a server-side programming language that executes scripts and actions using server resources. This implies that your WordPress installation and all of the plugins you install on your site use up server RAM.
Moreover, when WordPress or one of your plugins consumes too much server memory, the fatal error: allowed memory size of 41943040 bytes exhausted will appear. Plus, this problem occurs when the server’s allocated memory for your website is used up. Additionally, this is most common when hosting a high-traffic and large website on a small shared hosting server with limited PHP RAM allocated to each hosting plan. Following that, you must manually increase your server’s default PHP memory limit in order to fix this error.
>>> Read more: How to fix : http error image upload to media library in WordPress
1. Increase PHP Memory Limit in WordPress to fix fatal error: allowed memory size of 41943040 bytes exhausted
In order to increase the PHP memory limit in WordPress, you must firstly go to your WordPress site’s wp-config.php file and make the necessary changes. Besides, it is in the root folder of your WordPress website. And, you will need to use an FTP program or your web hosting control panel’s file manager to access it.
#1. To begin, you have to login to your CPanel by adding /cpanel to the end of your domain name. Then, enter the login credentials you received in your welcome email from your web host.
#2. To continue, you must open the File Manager and locate the Public.html folder
#3. After finding the wp-config.php file , all you have to do is right-click and choose Edit.
#4. Before appearing the line says “That’s all, stop editing! Happy blogging”, you must paste the code as we instruct below right above it.
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
#5. Finally, don’t forget to save your changes by clicking Save. More importantly, you should also reload your website to see whether the error has been resolved.
2. Disable and enable plugins
The fatal error: allowed memory size of 41943040 bytes exhausted is frequently fixed by increasing the PHP memory limit. If not, there is a high possibility that one of your website’s plugins is creating the problem. Hence, in order to figure out which plugin is causing the problem, you need to disable all of them and then reactivate them one by one until you locate the culprit. In reality, you will need to disable the plugins on the server because you can’t access your WordPress dashboard.
Following that, you will need to re-login to your server in order to do so.
#1. First and foremost, you have to log in to your server using the steps according to the first way.
#2. Then, let’s navigate to the plugins folder in the wp-content folder.
#3. After that, you must replace “plugins” with “plugins-bad” in the plugins folder. Moreover, you don’t have to worry because none of the installed plugins will be removed.
#4. Then, you must generate a new empty folder called plugins.
In fact, this will turn off all of the plugins that have been installed on your wordpress website. For more details, you have to reload your website to see whether the fatal error: allowed memory size of 41943040 bytes exhausted has been resolved. What’s more, if your website is now working normally, the problem was most likely caused by a plugin. In addition, you can return to the wp-content folder. Then, let’s rename the “plugins-bad” folder back to “plugins” and delete the empty folder you created earlier. As a result, this will restore your old plugins without requiring them to be activated. After that, you can now go to your WordPress dashboard and reactivate the plugins to figure out which one is causing the problem.
In conclusion
If you are using WordPress and facing the fatal error: allowed memory size of 41943040 bytes exhausted or any same error, it’s most likely due to a server problem. Besides, if these methods we mention above don’t work for you, it’s because your web hosting company won’t let you boost the PHP memory limit. This is the reason why you need to seek professional assistance. In order to fix this error effectively, let Arrowtheme assist you.
Additionally, our WordPress Packages will make you surprise with a lot of helpful solutions. Best of all, you can take a look at our Maintenance & Support WordPress services. For more details, you can subscribe to Monthly package to get off 20% or Annual package to get up to 30% off. Our professional support team can solve every error that is hurting your website to improve its performance effectively. Hence, all you need to do is to CONTACT US to be consulted.