Bug 952041 and Bug 952042 - Add support for tidy to DIY and PHP cartridges

* Add env variables and code to clean log directories
* Restore start/stop hooks to DIY cartridge