Well, I seem to have found a problem: it is something to do with the localhost directory.
Localhost is a directory, not a symlink, and I've tried renaming it to web0 and then putting a symlink called localhost, but that failed.
I've tried removing the localhost directory, but it comes back again.
The script goes through dozens of lines, then gets to
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126