Strict Standards: date() [function.date] Error

I was installing NagVis when I came across this weird message:

Strict Standards: date() [function.date]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable 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 ‘UTC’ for ‘GMT/0.0/no DST’ instead in /usr/local/nagios/nagvis/nagvis/includes/classes/objects/NagVisStatefulObject.php on line 360

It clearly says that I should check the timezone, which I did. But there’s nothing wrong with time or date. ntpd is running and it set the correct timezone so what could be wrong?

If you are reading this then probably you are seeing this error too. To fix this, open your php.ini using your favourite text editor (like vi) and add this line:

date.timezone=UTC

Take note that depending on how you installed php, it could be in /etc/php.ini (RedHat) or /etc/php5/apache2/php.ini (SLES) or if compiled, /usr/local/php5/php.ini.

You need to restart Apache for changes to take effect.