Bug 952041 - 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
Merge pull request #2073 from jwhonce/bug/952041

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