RESOLVED - Catch 22? - PHP Fatal error: -> DateTime::__construct():

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
B F
Posts: 33
Joined: Sat May 05, 2012 5:06 pm

RESOLVED - Catch 22? - PHP Fatal error: -> DateTime::__construct():

Post by B F »

Complete fresh new installation of CentOS Linux release 7.9.2009 (Core) and new Zoneminder from RPM Fusion today.

Part 4. of /usr/share/doc/zoneminder-common-1.34.23/README.httpd clearly states
Manually setting the timezone in /etc/php.ini is deprecated.

Instead, navigate to Options -> System from the ZoneMinder web console.
Do this after completing step 10, below.

Note that timezone errors will appear in the ZoneMinder log until this
has been completed.
However when I go to my Zoneminder install through a web browser I get a blank page with nothing in the page source. /var/log/httpd/ssl_error_log reports:
[Sun Feb 14 11:44:36.328926 2021] [:error] [pid 1650] [client 192.168.20.68:45044] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): 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. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /usr/share/zoneminder/www/includes/functions.php:2408\nStack trace:\n#0 /usr/share/zoneminder/www/includes/functions.php(2408): DateTime->__construct()\n#1 /usr/share/zoneminder/www/index.php(210): check_timezone()\n#2 {main}\n thrown in /usr/share/zoneminder/www/includes/functions.php on line 2408
Seems I need to set the timezone in Zoneminder's Options -> System but can't because PHP throws a fatal error due the timezone setting not being set. Web server is fine as I can view robots.txt.

Will break for lunch now and come back to it later in case this isn't the issue & I've missed something, but otherwise anyone got any ideas to get around this if it is a catch 22?
Last edited by B F on Mon Feb 15, 2021 1:04 pm, edited 1 time in total.
B F
Posts: 33
Joined: Sat May 05, 2012 5:06 pm

Re: RESOLVED : Catch 22? - PHP Fatal error: -> DateTime::__construct():

Post by B F »

Looks like ";date.timezone = " first has to be set in /etc/php.ini using the values given at http://php.net/date.timezone

Apache then needs restarting

Code: Select all

systemctl restart httpd.service
After that it's possible to set the timezone setting in Zoneminder via Options -> System -> TIMEZONE
Post Reply