With thanks to Rob Richards for tracking down a couple of big bugs caused by teeny bits of code.
Give it a new CLSID and change the engine name to ActivePHP5. Globals registered by the scripting host are now auto-globals and don't need to be declared global when accessed from within functions.