Date/Time functions and PHP 5.3

Thu, May 10, 2012 1-minute read

In case that you move your web site from PHP 5.2.x to PHP 5.3.x (like switch from one to another provider, or dev env) there is chance that you will see some errors inside your reports page.


gettimeofday(): 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.

Solving this problem can havfe various approaches but easier one is to edit your php.ini file (if your provider allow you) or to change .htaccess file (for a web site).

So, open .htaccess and add this inside PHP 5, Apache 1,2 group

    php_value date.timezone 'America/Vancouver'

restart apache server after this change

That is all.

\bye