Adding support for app_init

* Tested with magento to work properly