support longopts when PHP > 5.3; output full log if write enabled