TJ Kelly

WordPress Jetpack Memory Leak & PHP Fatal Error

No one likes seeing “fatal error” show up on their websites. In this case, the error happened when I installed and connected WordPress’ Jetpack plugin. I connected it to my WordPress.com account and, after being redirected back to my site, I saw this error:

Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes) in /path/to/domain.com/wp-admin/includes/template.php on line 262

The entire /wp-admin directory was inaccessible as a result of this memory fatal error—I couldn’t do anything to manage my website. Luckily, the public-facing side of things was running smoothly. Here’s what I did to solve the problem.

How to fix a WordPress Jetpack Memory Leak

As it turns out, the error is not caused by Jetpack. It’s triggered by the plugin and its settings. The real cause of the error is a lack of memory allocated to the PHP process by the server.

Step 1: Manually disable the plugin

Log into your server via FTP or some other direct access method. Find the /wp-content/plugins/jetpack directory and rename it. I added an “x” onto the end: /jetpackx. This causes WordPress to disable the plugin, since it can’t find the files associated with it. Voila, now your wp-admin area is accessible again.

Step 2: Edit your wp-config.php file

Disclaimer: this may not work on every server. If it doesn’t work for you, see below for more info and suggestions. Add this line somewhere in your wp-config.php file: define('WP_MEMORY_LIMIT', '64M'); That should up the memory limit your server is willing to grant to WordPress’ processes. 64M was enough for me and it fixed my problem perfectly. Your mileage may vary.

How I found the solution

I tweeted about this problem right away and the only responses I got suggested that I remove the plugin. That’s not an option here, so I had to keep looking

When that didn’t work, I took to the Googles. I found the support documentation for Jetpack and searched around in there. No one that I found had posted about my problem. So, I posted my own support topic.

The forum mods were quick to respond (and point out that I was mistaken in my diagnosis). They directed me to another WP support forum post. From there, I read through their advice and tried my own steps. If my advice above doesn’t work for you, try the other steps described in that forum topic. One of them should do the trick for you.

2 thoughts on “WordPress Jetpack Memory Leak & PHP Fatal Error

Leave a Reply

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