Cant get time set correctly

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
iitywygms
Posts: 113
Joined: Thu Nov 08, 2012 5:19 am

Cant get time set correctly

Post by iitywygms » Tue Dec 25, 2018 5:11 pm

Hi All:

Installed: 1.32.3-bionic
18.04 ubuntu

Installed using this link
https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way

Worked fine for several days.
I then decided I wanted to make the time correct on my zoneminder server.
Did this. dpkg-reconfigure tzdata
After that, it all went down hill. Failure to authenticate user. no image. socket errors. + more

I noticed at that the time in the log files was wrong. So I tried to make zoneminder use the right time by updating the php.ini files like below.

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/Los_Angeles

I live in california

I found 2 php.ini and updated them both the same.

/etc/php/7.2/apache2/php.ini
/etc/php/7.2/cli/php.ini

But no matter what I do, the time is not shown correctly in zoneminder. Always 7 hours ahead.
I am not sure this is what is causing all my sudden issues, but would like to get the time reported by zoneminder correct to at least eliminate that as the problem.

What am I not doing correctly?

Thank you.

iitywygms
Posts: 113
Joined: Thu Nov 08, 2012 5:19 am

Re: Cant get time set correctly

Post by iitywygms » Tue Dec 25, 2018 11:03 pm

Well solved it by purging and re installing zoneminder.
After new install all times were correct and no more errors.

Not sure why its fixed but it is.

User avatar
knight-of-ni
Posts: 2204
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Cant get time set correctly

Post by knight-of-ni » Wed Dec 26, 2018 12:37 am

There are three timezones on your system that all have to match:
- The operating system
- php
- mysql

If all three do not match, exactly, you will have breakage.

Setting the timezone in the OS should be straight forward.

You also have to set the exact same timezone in your php.ini file. Debian users have the added complexity of multiple php.ini files. Your question regarding which php.ini you should change is answered in the same instructions you linked earlier.

The third timezone is the least obvious. Mysql also has a timezone setting and in some cases it does not automatically follow the OS timezone. There are different ways to set the timezone too. One can set the TZ variable or set time_zone in the mysql config. How you set this will vary by linux distro.

So basically, when you changed the time zone after installing zoneminder, you set the system timezone, but the timezone in php and/or mysql no longer matched.... hence the breakage.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

iitywygms
Posts: 113
Joined: Thu Nov 08, 2012 5:19 am

Re: Cant get time set correctly

Post by iitywygms » Wed Dec 26, 2018 1:41 am

Thank you for the info.
I installed zm while the system time was not correct. Which was my first mistake.

To try and fix it I did set the time in both php.ini files, so the time setting must have been wrong in mysql?
I purged the zm database when I did the re install. Perhaps reinstalling the zm database fixed the mysql part that was wrong?

Anyway, all good now. Thank you again.

User avatar
knight-of-ni
Posts: 2204
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Cant get time set correctly

Post by knight-of-ni » Wed Dec 26, 2018 12:40 pm

Even though you worked around the issue, I wanted to post the background behind what is happening and how to fix it, to help others. You are not the first person to run into this, and most certainly won't be the last.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

bbunge
Posts: 2272
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Cant get time set correctly

Post by bbunge » Wed Dec 26, 2018 1:17 pm

Just to add my $.02 on this, the install script you used reads the system time configuration (/etc/timezone) then appends the/etc/php/7.2/apache2/php.ini file with the time zone. This was done to save a bunch of manual edits during install. For most folks this is not an issue but when you start fiddling with settings after install things can break. Always best to set your time zone at OS install.
Glad you got it fixed!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests