Timezone error

Forum for questions and support relating to 1.33.x development only.
Locked
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Timezone error

Post by racelife »

I just did a new install ubuntu 18.04 via the easy way script I just changed the ppa from zoneminder-1.32 to zoneminder-master and I'm getting an error:

Code: Select all

ZoneMinder is not installed properly: php's date.timezone +0000 does not match the system timezone -0600!
So I assume I need to update a php file somewhere but which one?
Here is the output of the following

Code: Select all

root@*********:/etc# sudo grep -r date.timezone ./
./php/7.2/cli/php.ini:; http://php.net/date.timezone
./php/7.2/cli/php.ini:;date.timezone =
./php/7.2/apache2/php.ini:; http://php.net/date.timezone
./php/7.2/apache2/php.ini:;date.timezone =
./php/7.2/apache2/php.ini:date.timezone = America/Denver
/etc/php/7.2/apache2/php.ini

Code: Select all

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

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
/etc/php/7.2/cli/php.ini

Code: Select all

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

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
Also in the easy way script other than changing the ppa is there anything else I should change for future installs? right now I am just testing with vm's till I get it right and running the best it can.

This is the script as I used it:

Code: Select all

#!/bin/sh
clear
read -p "This script installs Zoneminder 1.32.x on Ubuntu 18.04 AMD64 with LAMP (MySQL) installed...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder. 
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-master
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Timezone error

Post by bbunge »

The script pulls the timezone from the OS and apends the php.ini file. Manual install has you edit the php.ini with nano and search for date. Then add your timezone. Plenty of examples in the wiki.
I ran that script yesterday, modifying for master ppa, on a fresh Bionic server with no issues. Possible your vm install of Bionic did not work right?
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Timezone error

Post by racelife »

Just nuked the vm and did everything again and same error. I added the timezone in the apache2/php and cli/php still no luck.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Timezone error

Post by bbunge »

This is the line in the script that fills the timezone


awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini

Check the file /etc/timezone to make sure it is correct for your area.
Next check /etc/php/7.2/apache2/php.ini at the very end of the file for the date.timezone = entry and correct if needed.
User avatar
iconnor
Posts: 2882
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Timezone error

Post by iconnor »

Guys I moved the timezone setting into options. SO now you can set it from the UI. Options->System->Timezone.
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Timezone error

Post by racelife »

bbunge wrote: Sun Oct 20, 2019 11:55 am This is the line in the script that fills the timezone


awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini

Check the file /etc/timezone to make sure it is correct for your area.
Next check /etc/php/7.2/apache2/php.ini at the very end of the file for the date.timezone = entry and correct if needed.
Yep did all that. Still didn't work.
iconnor wrote: Sun Oct 20, 2019 3:34 pm Guys I moved the timezone setting into options. SO now you can set it from the UI. Options->System->Timezone.
Excellent 👍 I'll take a look when I get home
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Timezone error

Post by rockedge »

silly question really, was the Apache server restarted after any modification to the php.ini?

possibly run

Code: Select all

<?
phpinfo();
?>
and insure that you are modifying the php.ini that is being read.

just double checking
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Timezone error

Post by racelife »

Yep. I also restarted the machine after every change. But as mentioned above it is now in the UI
yaronimo
Posts: 3
Joined: Fri Oct 25, 2019 8:48 am

Re: Timezone error

Post by yaronimo »

iconnor wrote: Sun Oct 20, 2019 3:34 pm Guys I moved the timezone setting into options. SO now you can set it from the UI. Options->System->Timezone.
Thanks! Problem solved (in my case).
I could not see the live monitors using a browser on my computer but using zmninja on my cell phone I had no problem.
Does it mean that the timezone value has no effect on zmninja ?

Is the timezone value inside options/system a new feature?
I couldn't find it elsewhere but it is definitely the solution to the authentication errors that were shown in the logs.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Timezone error

Post by asker »

yaronimo wrote: Fri Oct 25, 2019 9:03 am Does it mean that the timezone value has no effect on zmninja ?
If you don't set the new timezone option in ZM correctly, zmNinja should show wrong timestamps when browsing events (because the timezone API will return UTC).
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Locked