📜 ⬆️ ⬇️

Wrong time on FreeBSD is no big deal. UPD: And in PHP is not scary too

As we all know, in 2011, by a presidential decree, the transition to winter time was canceled. However, on October 30, the clock was transferred on many computers. We will not find out why the necessary updates were not downloaded in time installed (negligence of administrators or the impossibility of this operation). The main thing now is to bring the clock to the current state. Specifically, it will be about FreeBSD OS. Who has not passed this cup - I ask under the cat.

So, we have a server running FreeBSD, in my case version 7.0. First of all, using the date command, we check the current time. If the time is correct, you can safely close this post and continue not to read; otherwise, the problem is "on the face." To solve the incident, we need to update the time zones and select from them the one we need.

To begin, update the ports, there are several ways to choose which one to decide. I have successfully worked with cvsup (once added to cron, it always allows you to have the current version of the ports). Next, go to / usr / ports / misc / zoneinfo and do the usual make install clean && rehash . That's it, now we have an up-to-date list of time zones. It remains only to choose the correct time zone and the case in the hat. We start the tzsetup utility, and select our time zone from the list. In my case (the server is in Novosibirsk) it is Asia - Russian Federation - Moscow + 3 Adepts of the console, of course, can do it manually
')
# cp /usr/share/zoneinfo/vash_chasovoy_poyas /etc/localtime 

After that, I would still recommend restarting the server entirely, as it became known from the post dave42 and comments to it, cron and mysql will continue to work with the wrong time until restart, perhaps other demons will also behave in a bad way. Well, if there is no opportunity to reboot the server, then at least restart the services separately. I hope someone helped, thank you for your attention.

UPD
Below, in the comments, Nastradamus reports that another fact of service failure was revealed, namely PHP (I have also noticed this thing):

Nastradamus November 1, 2011, 14:57
Faced such a thing in PHP.
phpinfo ():

date
date / time support enabled
"Olson" Timezone Database Version 2010.9
Timezone Database internal
Default timezone Europe / Moscow

PHP module to Apache, Apache restarted.

Here I think how to solve the problem - php shows the time an hour earlier.
Probably need to rebuild php.

Nastradamus November 1, 2011, 15:08 # ↑
Damn, rebuilding the port did not help.
I urge everyone to think. The problem is serious!
Speech on FreeBSD and PHP 5.2.17_3

Nastradamus November 1, 2011, 15:21 # ↑
A full reboot of the test bench did not help!

Nastradamus November 1, 2011, 15:27 # ↑
It was done like this:
1) pecl install timezonedb
2) add the line to the /usr/local/etc/php/extensions.ini file:
extension = timezonedb.so
3) restart Apache

I'd add if in the process of pecl the following error occurred:
 # pecl install timezonedb pecl.php.net is using a unsupported protocal - This should never happen. install failed 

then do the following:
 # cd `pecl config-get php_dir` ( :   mc  cd `pecl config-get php_dir`  ,     ,     ) # mv .channels .channels-broken # pecl update-channels 

and then repeat again
 # pecl install timezonedb 

Say thanks uv. Nastradamus for the decision, from me the rays of goodness into karma :)

Source: https://habr.com/ru/post/131535/


All Articles