Overcoming Memory Exhaustion: A WordPress Website Maintenance Success Story

Recently we had a new client come to us with a problem. Their regular website maintenance was lacking and their site was non-functional. It was showing the dreaded “There has been a critical error on your website”. When you see this it makes you think what can I do when my website is broke!

Wordpress showing there has been a critical error on your website emphasizing the need for regular website maintenance.

The worst part about these errors is that many times it’s not super clear what actually is going on. Moreover, if you didn’t notice this problem after some change you made it might be even more mysterious!

Well our team at Fix It Website Support was there to kick things into high gear and get this client back online.

Initial Investigation, We Need Website Maintenance

First step we took was to see if we could login to the Admin portal and thankfully the admin portal was functional! This was great news as that means its not a complete failure of the website and WordPress, its just something on the front-end that is causing some hiccups.

Looking through the WordPress core and plugins, there was a lot of updates that could be done. While website maintenance and updates can be a crucial factor in issues like this, we wanted to dig a little deeper to understand the problem before we effectively “rebooted it”.

Without web hosting access, we decided to install a quick File Manager plugin so we could investigate the logs and see if anything stood out from a plugin perspective or an overall WordPress perspective.

We installed a plugin called File Manager by  mndpsingh287. We have used this plugin in the past and have appreciated its ease of use and the ability to get what we needed done quickly without having to install a license just for this quick fix.

The first stop was in the list of things to check out was the error_log file to see if there were any errors that could point us in the direction of the problem. This file is generally found in the root folder of the wordpress installation. The name error_log is pretty common but it could vary depending on the web hosting platform you are on. To our instant delight we found our first, and hopefully final, culprit. We had some memory exhaustion errors in the error_log. While its never something you want to see it is a pleasant surprise when you are looking for a needle in the WordPress critical error haystack.

This error is telling us that the maximum memory allocated to this website during the error was 134,217,728 bytes. When we convert that to a number that would generally be configured in a Web Hosting platform, PHP or WordPress, it comes out to 128 Megabytes (134,217,728 / 1,048,576 = 128) or 128M.

Just for clarity we decided to look into what the web hosting platform and PHP was configured for in regards to memory. WordPress gives us that information. Looking in the Admin sidebar under Tools > Site Health. Once in Site Health we check the Info tab, and look under the Server section.

We can see on this site it was set to 128M, which lines up perfectly with the error messages we were seeing.

Without hosting access making a change to fix this can be very risky and can leave your site, including your admin area completely useless until you are able to get to the web hosting control panel.

Because this is what we do we decided to proceed with the surgery. We ensured that we had our own local backup copy of the site before making any changes. Once the backup was complete we used our File Manager again to edit the WordPress configuration file called wp-config.php.

Changing ANY file in your WordPress installation can render your site completely broken. Always ensure you have a backup before making any changes to your live site and never edit files you are not comfortable with editing.

We added a couple lines to the file to increase the memory available to PHP and WordPress. We made an assumption here that the Web Hosting plan would allow for this amount. We know that WordPress configurations generally set the memory limits for admin pages double of the regular page serving memory limits. This is a safe guard to ensure you can get to your admin even if you exhaust your main website memory.

With this in mind we added a line to the wp-config.php file that allowed the website to use up to 256M of memory.

This would likely get the site back up and running and would give the owner some room to breathe until they could do some website maintenance and figure out what was using all of their memory. We added a comment to the file to ensure that future users looking at or changing this file doing their own website maintenance would be clear that someone was in here.

With the file saved, it was the moment of truth. We refreshed the home page and we had success! The page was loading and the error log was clean of errors.

The day was saved and the web site owner lived happily ever after. 

Ok not exactly, while we had saved the day, there is still work to do. We let the owner know what had happened, what we fixed and then most importantly we expressed how important regular website maintenance is to a website. Always making sure your plugins are updated, WordPress core is updated and themes are updated. Not only does this help ensure your site remains fast and performant, its also critical for the security of your website. Lastly we pointed them to an article by Skybrant Web Solutions discussing the importance of regular website maintenance.

I hope you found this article not only informative but helpful in troubleshooting your site if this ever happens to you.

Good luck fellow digital darlings, until next time!

Skip to content