How to Fix WordPress Fatal Error: Allowed Memory Size Exhausted

If you have just installed WordPress on your shared hosting and trying new things with it then you might face issues like 500 internal server error , PHP Fatal error, etc. To fix such errors in WordPress is like eating piece of cake. If you are here for any one of the reasons i.e., 500 internal server error or PHP Fatal error then you better read the rest of the article.

Recently, I installed WordPress on my site and tried to install plugins like W3 Total cache for page speed, Yoast SEO for making site’s SEO better and when I installed JetPack WordPress official plugin I faced both of these errors i.e., 500 internal server error and PHP Fatal error. When I went into the error_log file (you can find in your WordPress root directory, where you installed WordPress), I found PHP Fatal Error inside the file, you can see in the screenshot below:

PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 786432 bytes) in /public_html/wp-content/plugins/jetpack/locales.php on line 2149

That’s where I began to research about this error and why this error happened at the very first place in my newly installed WordPress site. So the answer and how to fix PHP Fatal error is given below.

Fixing WordPress Fatal Error: Allowed Memory Size Exhausted

First thing’s first, this PHP fatal error happened because your server is shared or also because some plugins need a bit higher memory limits to run. And because shared server administrators give specified memory limit to applications like PHP.

If your WordPress encounters PHP fatal error, WordPress first tries to increase PHP memory limit automatically and if it is less than 64MB.

How to fix WordPress Fatal Error: Allowed Memory Size Exhausted 

First, go to root directory of your WordPress blog now look for file wp-config.php and edit it.

Now, you need to put the following line of code inside wp-config.php just before the line that says:

‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );

Save the wp-config.php file and try accessing your site now. I hope you, your issue is now fixed. If now, comment below what else your blog is facing besides WordPress PHP Fatal Error or 500 Internal Server Error.

Leave a Reply

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