Site Heath crashes with Fail2ban

Using the current version of Fail2ban. This also happened in the previous version as well.

When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.2.2
Current plugin: WP fail2ban (version 5.1.1)
PHP version 8.0.29

Error Details

An error of type E_ERROR was caused in line 391 of the file /sites/sitename.com/files/wp-content/plugins/wp-fail2ban/lib/site-health.php. Error message: Uncaught Error: Call to undefined function org\lecklider\charles\wordpress\wp_fail2ban\exec() in /sites/sitename.com/files/wp-content/plugins/wp-fail2ban/lib/site-health.php:391
Stack trace:
#0 /sites/sitename.com/files/wp-admin/includes/class-wp-site-health.php(194): org\lecklider\charles\wordpress\wp_fail2ban\SiteHealth->get_test_fail2ban_running()
#1 /sites/sitename.com/files/wp-admin/includes/class-wp-site-health.php(145): WP_Site_Health->perform_test()
#2 /sites/sitename.com/files/wp-includes/class-wp-hook.php(308): WP_Site_Health->enqueue_scripts()
#3 /sites/sitename.com/files/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#4 /sites/sitename.com/files/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 /sites/sitename.com/files/wp-admin/admin-header.php(118): do_action()
#6 /sites/sitename.com/files/wp-admin/site-health.php(96): require_once(‘…’)
#7 {main}
thrown

**Fatal error**: Uncaught Error: Call to undefined function org\lecklider\charles\wordpress\wp_fail2ban\exec()
in **/.../wp-content/plugins/wp-fail2ban/lib/site-health.php** on line **391**

Call stack:

1. `org\l\c\w\w\SiteHealth::get_test_fail2ban_running()`
wp-admin/includes/class-wp-site-health.php:194
2. `WP_Site_Health::perform_test()`
wp-admin/includes/class-wp-site-health.php:145
3. `WP_Site_Health::enqueue_scripts()`
wp-includes/class-wp-hook.php:308
4. `WP_Hook::apply_filters()`
wp-includes/class-wp-hook.php:332
5. `WP_Hook::do_action()`
wp-includes/plugin.php:517
6. `do_action()`
wp-admin/admin-header.php:118
7. `require_once()`
wp-admin/site-health.php:96

Same here. Happened in v5.1.0 as well.

WC Version: 7.8.2
REST API Version: :heavy_check_mark: 7.8.2
WC Blocks Version: :heavy_check_mark: 10.5.0
Action Scheduler Version: :heavy_check_mark: 3.5.4
Log Directory Writable: :heavy_check_mark:
WP Version: 6.2.2
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: :heavy_check_mark:
WP Cron: –
External object cache: :heavy_check_mark:

Server Environment

Server Info: nginx/1.18.0
PHP Version: 8.0.29
PHP Post Max Size: 64 MB
PHP Time Limit: 600
PHP Max Input Vars: 7000
cURL Version: 7.81.0
OpenSSL/3.0.2

OK, so it seems PHP8 doesn’t gracefully handle having exec() disabled. Joy.

Can you try changing line 387 of wp-fail2ban/lib/site-health.php to:

if (function_exists('exec') && file_exists('/usr/bin/systemctl')) {

and let me know what happens?

2 Likes

That seems to have fixed the problem. The site-health is loading and displaying wp-fail2ban items correctly. Thanks!

BTW: Is it possible to disable the recommendations for Blocklist / Contactform /… Addons?

Thanks for the quick response! :slight_smile:

That resolved it. Thanks. I wasn’t worried about it - but i had another issue with a different plugin and they thought this was the issue LOL

A post was split to a new topic: Disable Site Health add-on suggestions