(I think) I've fixed this (for now).

The value of VIRTUAL_PATH was being detected incorrectly.