Linux 软件免费装
Banner图

Fatal Rescue

开发者 kapoordev
更新时间 2026年12月2日 12:37
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

debug security maintenance error fatal error

下载

1.0.0

详情介绍:

When a plugin fatals, WordPress shows "There has been a critical error on this website" to everyone, and the usual fix is to log in and deactivate it. You cannot log in. Recovery Mode emails a link that only works for one browser on one device, and if the database or the theme is the problem, it often fails too. Fatal Rescue changes what happens on the server: The visitor-facing page is a plain "temporarily unavailable" notice. Only a logged-in administrator sees the diagnosis, and the recovery link is never printed on a page any visitor can read. What this is not It is not a backup plugin and it does not repair code. It does not stop a fatal from happening; it stops one fatal from taking the site down while you decide what to do. Use it with backups, not instead of them. How it works WordPress registers its fatal-error handler at wp-settings.php line 69, before plugins and themes load, and only a wp-content/fatal-error-handler.php drop-in can replace it. A normal plugin registering shutdown runs too late: core's handler has already rendered the error page and exited. On activation, Fatal Rescue installs two small files to get in front of that:
  1. wp-content/fatal-error-handler.php — captures the fatal and names the extension responsible.
  2. wp-content/mu-plugins/fatal-rescue-loader.php — filters option_active_plugins, option_template and option_stylesheet so the quarantine applies to every visitor.
Those two files are also the only way a URL can reach any PHP this plugin ships. The recovery panel answers at whichever of them this install owns — the drop-in normally, and the mu-plugin when another tool holds the handler slot — and it reads the state file directly, with no database, no theme and no other plugin loaded. Request any file inside the plugin folder and you get a blank page: the panel code exits before it runs anything unless one of its two guards called it. Everything else lives inside the plugin folder. The recovery state is a JSON file in wp-content/uploads/fatal-rescue/, outside the plugin directory, so a plugin update or a failed upload mid-update cannot delete the record of what is paused. That folder carries its own deny rules, the file is written 0600, and its name is a random per-install token rather than state.json, so a request that guesses the URL finds nothing even on nginx or IIS, where .htaccess is never read. If you would rather block the folder outright at the server level, deny wp-content/uploads/fatal-rescue as you would any other protected upload folder.

安装:

  1. Plugins → Add New → Upload Plugin → fatal-rescue.zip → Install Now → Activate.
  2. Read the panel URL in the green notice and save it somewhere outside the site (password manager, notes app, phone). It is the only way in when the site is down. The plugin never sends it anywhere on its own: use the "Email me the panel link now" button on the Fatal Rescue screen when you want a copy off the site.
  3. That is the whole setup. Nothing needs configuring, and there is nothing to do until something breaks.
If wp-content/ is not writable by PHP, the plugin tells you exactly which two files to upload and shows their contents. Both are removed on deactivation, and never overwritten if another tool owns them.

屏幕截图:

  • The Fatal Rescue screen in wp-admin while a rehearsal is running: guard status, the two files it owns,
  • What a visitor sees while a broken extension is quarantined instead of a PHP stack trace: a plain

升级注意事项:

1.0.0 First release. The panel URL is shown on the Fatal Rescue screen when you activate - save it somewhere outside the site, since it is the only way in during an outage. A notice with that link is mailed only when a fatal is actually caught.

常见问题:

Does pausing a plugin delete its settings?

No. The active_plugins option is never modified. The extension is filtered out at load time, which is why Restore is instant and safe.

Does this work when the theme is the problem?

Yes. A fatal in a theme's functions.php is attributed to the theme, and pausing it switches to a bundled default theme such as Twenty Twenty-Five until you restore yours.

Does the panel get emailed to me?

Not on activation. Installing the plugin sends no mail of any kind, because the link is a credential and an inbox is not a place to put one unasked. What does get emailed is an outage: when Fatal Rescue catches a fatal, the next page view mails the site admin address a notice naming the extension, the stage it died at, and the panel link. The send happens on the next page view rather than inside the crash - the fatal handler runs at shutdown with whatever is left of a working WordPress, and a fatal caused by the database cannot also be delivered by a database query. There is no cron and no third-party service, so a site nobody visits holds the notice until someone loads a page, and the Fatal Rescue screen always shows what is waiting and why. You can ask for the link itself at any time with the "Email me the panel link now" button, which is also how you prove the site can deliver mail before an outage has to depend on it. Nothing sends that one unasked. Delivery goes through wp_mail(), so it follows whatever mail setup the site already has. Define FATAL_RESCUE_NO_MAIL in wp-config.php to stop it, or point the fatal_rescue_notify_email filter at an agency address. A site that cannot send mail says so on that screen instead of failing quietly.

Can it fix a broken must-use plugin?

It reports one honestly and tells you to rename it over FTP. WordPress loads mu-plugins/ before any filter runs, so no plugin — including this one — can skip an mu-plugin. That is a WordPress limitation, not a Fatal Rescue shortcut.

Does it work on a multisite network?

Yes, with one consequence worth knowing. Both guard files and the recovery state live once per installation — in wp-content/, not per site — because they are read before WordPress resolves which site a request is for. So pausing an extension from any site's panel pauses it for the whole network, and Restore returns it network-wide. You do not need to network-activate it: activating on one site installs the shared guards that cover every site. The Fatal Rescue screen is registered under each site's admin rather than Network Admin, so run the rehearsal and the mail test from the site you activated on.

How do I know this works before an outage?

Run a rehearsal from the Fatal Rescue screen. The failure comes from src/rehearsal-fixture.php, a file this plugin ships and loads only while a rehearsal is armed, so nothing executable is ever written to your site. Arming writes one file: an expiry marker holding one integer, in wp-content/uploads/fatal-rescue, the folder Fatal Rescue already keeps its recovery state in. The next front-end page view fatals for real; Fatal Rescue catches it, names Fatal Rescue Rehearsal as the culprit and hands you the panel. Pause it and the site renders again; stop the rehearsal and the marker is deleted. If you walk away, the marker expires in five minutes and the rehearsal ends on its own. Your own plugins, themes and options are never involved.

Will it slow my site down?

On a healthy site it registers four option filters, records which bootstrap stage WordPress is in, and touches no database and no file on the request that renders a page: the one write it makes is a refresh of the plain-file snapshot of what is active, and that happens only when the list actually changes or once an hour. No cron job, no outbound request, no query. Mail leaves only when there is something to report, and it reads the state file the guard had already loaded. The settings screen and the installer are only loaded on admin requests, and fatal-error-handler.php is read by WordPress only when a fatal is already happening. Nine interleaved pairs of the same page on a local test bed (guard files present, guard files renamed away) came out within noise of each other; absolute timings on one laptop track swap, not code, so the paired comparison is the one worth quoting.

What happens if another plugin already owns the fatal-error handler?

Fatal Rescue leaves that file alone and says so on its settings screen. Quarantine still works, so a broken extension is still skipped for every visitor; only the custom error page belongs to the other tool. The recovery panel moves to its other guard file, wp-content/mu-plugins/fatal-rescue-loader.php, and the link on the settings screen, in the dashboard notice and in the outage email points there instead — so the page you open from your phone on the day the site is broken is still there.

更新日志:

1.0.0