You may have noticed that the OSSEC Web Interface stopped working (as of today on a new installation) or after updating PHP on your server.
Looking at the logs, you most likely found a similar entry:
PHP Fatal error: Uncaught Error: Call to undefined function split() in /var/www/html/ossec/lib/os_lib_agent.php:111\nStack trace:\n#0 /var/www/html/ossec/site/main.php(33): os_getagents(Array)\n#1 /var/www/html/ossec/index.php(126): include(‘/var/www/html/o…’)\n#2 {main}\n thrown in /var/www/html/ossec/lib/os_lib_agent.php on line 111
It appears that split() is no longer supported on new PHP version (there was no recent release of the WebUI code for years, this isn’t unexpected and should consider alternatives) however, here is how to get it to work again:
1. Edit the “os_lib_agent.php” file:
vi /var/www/html/ossec-wui/lib/os_lib_agent.php
2. Locate the line #111 – the current entry should be as followed:
@list($_name, $_ip) = split("-", $tmp_file, 2);
3. Edit/change it to the following instead:
@list($_name, $_ip) = explode("-", $tmp_file, 2);
Your OSSEC WebUI should now be working again.