Beginning of a PHP rewrite of the dunit script.