|

PHP Errors: Auto Plugin Updates and Fatal Error Notify

PHP Errors: auto-updates, and fatal error notify

Have you considered turning on automatic updates for plugins? WordPress is encouraging users to do just that. One of the tenets of WordPress security is to keep everything up to date, and automatic updates is one way to ensure that happens. I’ve actually done that, turned on automatic plugin updates, for some of my sites. So far there haven’t been any issues, but it feels a bit risky. We’ve all seen on support forums and social media users saying that a plugin update ‘broke my site’. Whatever “broke my site” means, often it involves a PHP error. So in this video, I’m going to discuss plugin updates, a new feature that’s coming in WordPress 6.6 that may help, and a free plugin that helps in reporting PHP errors.

Video Version

The Practicality of Testing Updates on a Staging Site

Reminder: Always have current backups before updating your site.

I’ve often seen when users report that an update “broke my site” that support or other users will chime in with the common wisdom that you should first test updates on a staging site before making them live. Now, if you have a busy e-commerce store, or if you have a high traffic e-commerce store, a busy membership site, or you’re taking care of some high profile site, or for any reason a site you’re responsible for cannot tolerate any downtime, then yes, you absolutely should test the updates first on a staging site. But what happens if you have a couple of dozen or maybe hundreds of sites on your maintenance care plan? It’s impractical to spin up a staging site for every one of those.

I’ve been thinking about this conundrum for a while and have come to the conclusion that I should split the sites into two groups. Priority sites will be tested, updated, and checked manually, with special attention to any critical or special functionality. The rest of the sites will have auto-updates turned one and I’ll spot check them.

It makes sense that sites that require special attention be on a higher level of care plan so that you are compensated for the extra time and attention they require. But, reality check, I think most people apply updates without creating a staging site first.

WordPress 6.6 Rollback on Error for Auto-Updated Plugins

There is good news that can help us feel more confident. WordPress 6.6 is going to include auto rollback for auto updated plugins. What this means is that if a PHP error is detected, WordPress will automatically rollback to the previous version of the plugin. WordPress will test for a PHP error by doing a callback request to the home page. It’s likely that that kind of simple test will catch a number of issues.

Sometimes, however, a PHP error is only invoked when you visit a particular page. For example, a recent Kadence Blocks bug was only triggered on pages where the Kadence Gallery Block was being used. In these kinds of cases, since the error is only triggered in certain types of circumstances, you might not notice the issue even if you first tested the update on a staging site.

Fatal Error Notify to Report on Lurking Bugs

One of the worst things that can happen is that users are experiencing a bug on your site and you have no idea. If you don’t know about the issue then you can’t fix it. So I wanted to tell you about a free plugin that’s available in the WordPress plugin directory. It’s called Fatal Error Notify.

You can see that it’s got more than 7,000 active installs, good ratings, and one out of one support issue has been addressed. Actually, this isn’t a plugin that really requires a lot of customer support.

Wait, if there’s a PHP error then you may be wondering, how can this plugin report the error to you? Here’s the answer in their FAQ: “Fatal Error Notify hooks into PHP’s shutdown function to send notifications right before the page stops loading. Even the dreaded 500 internal server error still triggers PHP shutdown actions. Even if your site is completely offline, in most cases this plugin will be able to detect the error and notify you.”

Here is the Fatal Error Notify website. What the free version does is it allows you to set the level for the types of issues you want reported, and then it sends you an email with a stack trace of the error.

There is also a pro version that will do logging. The pro version also has a stealth mode where the plugin settings can only be changed by certain users, it supports multi-site, and it will send Slack notifications or SMS notifications. The pro version also integrates with some popular plugins to provide error reporting and error logging. I imagine that the pro version would be a good tool for developers to have on their development and testing sites. It would also be a good tool to have on those high profile sites that get extra attention. Fatal Error Notify is made by Very Good Plugins, the same group that creates the well-respected WP Fusion plugin.

Quick Look at the Fatal Error Notify UI

The user interface for the free version is pretty simple. Let’s install it and take a look. I’m here on a test site. I go to add new plugin, search for it, install it and I’ll activate it. Now lets go to the settings page. Here you can set whether you want errors, warnings, parse errors, deprecation notices and so on. Okay, so I’m going to save and now send a test so we can see what the email looks like.

Here’s the email I received. You see it shows the uncaught error and then it gives you the stack trace. So this is the kind of notification that you’ll receive.

I’ve actually been using Fatal Error Notify, the free version, for a couple of years and it’s been helpful. I’ve found issues that I otherwise wasn’t aware of. So this is definitely a recommended plugin.

I think that the rollback on error for auto-updated plugins, which is coming in WordPress 6.6, together with Fatal Error Notify will help us feel more confident about auto-updates and also help us with those hard to find lingering PHP errors.

If you have some suggestions or information related to making auto-updates safer then please share them in the comments below the video or in the comments for the text version of the video, which is available on the WebTNG website. I hope you found this video interesting and helpful. If so, please give the video a like and subscribe to the channel. Thank you for watching.

Similar Posts

Leave a Reply

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