Added PHP Exception handling & logging