Categories
Unix & Linux

Incorrect time for Russia/Moscow timezone on FreeBSD

Now Russia/Moscow use MSK (GMT+4) timezone, how to fix it?

First of all you should update your ports tree. If you never updated it, run:

$ portsnap fetch extract
$ portsnap fetch update

Else run:

$ portsnap fetch update

Then you need to install port zoneinfo:

$ cd /usr/ports/misc/zoneinfo
$ make install clean
$ rehash

If you are using php, you need to intall pecl-timezonedb:

$ cd /usr/ports/misc/pecl-timezonedb/
$ make install clean
$ rehash

Check /usr/local/etc/php/extensions.ini for string:

extension=timezonedb.so

Check /usr/local/etc/php.ini for string:

date.timezone = "Europe/Moscow"

If you use MySQL you need to update its tz tables:

$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot_password mysql

Now you can reboot your server.

Leave a Reply

Your email address will not be published. Required fields are marked *