Error with DateTime::__construct() and date.timezone


When I run te following command line in my server:

$ php -r '$d = new DateTime("2017-05-22");'

It works great.

On other hand I have an symfony web application in the same server with below method:

function createAdFromFeedAction(Request $request){   try{   $ad_values = $request->request->all();   $datetime = new DateTime($ad_values["date"]);   }   catch(Exception $e ){   echo $e->getMessage();   }  }  

But I get the exception message:


DateTime::__construct(): It is not safe to rely on the system's   timezone settings. You are required to use the date.timezone setting   or the date_default_timezone_set() function. In case you used any of   those methods and you are still getting this warning you most likely   misspelled the timezone identifier. We selected the timezone 'UTC'   for now