I've made a test and it works.
You need to put the statement:
$_SERVER['DOCUMENT_ROOT'] = "/usr/local/emhttp";
In front of the require_once statements in your standalone scripts, and you are good to go.
Once you have updated, I am going to remove the hard-coded path.
Side question:
Does this have any side-effects on stuff called via the UI? I didn't notice anything with FCP since scan.php can be executed either way (kinda) but would drop my testing time significantly with CA since I have to do everything three times (with bleeding edge and without, and with 6.1.9)
That's the whole point, when executing a script in CLI (standalone) mode it is not possible to pass on server settings, hence the statement to mimic.
In other words there won't be any side-effect calling your script via GUI or directly.
CA updated. Doesn't have the other thing we were talking about, but that'll be done tomorrow (tons and tons of testing required on it)