Let's take a step back - why are you unmounting from a cgi script?
It's a one-time setup when a user configures a new system. Most of these users aren't shell-literate, so they configure by ticking boxes on a web page. The system is a VPS, so is actually a VM, which I hope isn't relevant.
Anyway, when configuration completes, all the scripts are
deleted and Apache runs 'normally'.