php timezone

The forum for help and support with FreeNATS as well as any useful hints and tips
Post Reply
paullanders
Posts: 92
Joined: Thu Sep 04, 2008 9:48 pm

php timezone

Post by paullanders » Thu May 24, 2012 3:03 pm

Hi Dave. I'm running Version: 1.13.3/b on Debian 7.0 Wheezy. cron is issuing these 2 errors:

Code: Select all

PHP Warning:  date(): 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 /opt/freenats/server/base/screen.inc.php on line 320
PHP Warning:  date(): 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 /opt/freenats/server/base/freenats.inc.php on line 93
What shall I do?

Thanks!

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: php timezone

Post by dave » Thu May 24, 2012 11:01 pm

Hi Paul,

Ok well looking at this it seems that your best option may be to just set the date.timezone setting in your PHP INI file (this is normally /etc/php.ini).

Description of the date.timezone option: http://www.php.net/manual/en/datetime.c ... e.timezone

And a list of possible timezones: http://www.php.net/manual/en/timezones.php

I think I'll put this in as a programatic option in FreeNATS (checking default from php.ini and then using configured setting if not set) but I'll need to do a bit of investigation into this first as my worry is it'll mess up existing test data. Putting your php.ini timezone to your correct timezone (the same one as your system is currently set to) looks like it /should/ not affect existing records as they'll be recorded against your timezone.

Having looked at the timezone list I can't see one for Texas but I don't know the geography. There are some 'general' timezones under Other but another note says you should avoid these.

Let me know if this works for you or not.

Regards,

Dave.

paullanders
Posts: 92
Joined: Thu Sep 04, 2008 9:48 pm

Re: php timezone

Post by paullanders » Tue May 29, 2012 2:30 pm

Dave, this seems to have resolved the issue. Thank yo so much for your help :-)

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: php timezone

Post by dave » Tue May 29, 2012 4:58 pm

Great glad it worked.

Cheers,

Dave.

Post Reply