Elxis CMS Forum

Support => General => Topic started by: chongbing on August 21, 2015, 06:12:55

Title: Error about date function
Post by: chongbing on August 21, 2015, 06:12:55
After update to php 5.6 on my host, I found this error. Does anyone know how to fix it ?  Thanks,

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 /home/easyapps/public_html/includes/version.php on line 22

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 /home/easyapps/public_html/includes/version.php on line 22

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 /home/easyapps/public_html/includes/version.php on line 23

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 /home/easyapps/public_html/includes/version.php on line 23
Title: Re: Error about date function
Post by: datahell on August 21, 2015, 13:20:11
Your php installation has no default timezone defined in php.ini file. Open file php.ini and set the default timezone like this:

date.timezone = "Europe/Athens"

You might need to restart apache after this.
Title: Re: Error about date function
Post by: chongbing on August 21, 2015, 14:21:01
Hi datahell,

Thanks for your reply.

Yes, I've defined this in the path /home/easyapps/public_html/php.ini as below,

date.timezone = "Asia/Taipei"

and restart HTTP Server (Apache) then test again. But it still got same error message. Any suggestions?
Title: Re: Error about date function
Post by: chongbing on August 21, 2015, 17:14:04
Hi datahell,

I found the issue was the .htaccess file, after adding recursive coding. It works now.

Many thanks,

Title: Re: Error about date function
Post by: chongbing on September 27, 2016, 21:40:43
Hi datahell,

I found the issue was the .htaccess file, after adding recursive coding. It works now.

Many thanks,

If you get a 500 error you might try checking for the PHP5 module. Following it works for me.

<IfModule mod_php5.c>
php_value date.timezone "Asia/Taipei"
</IfModule>
Title: Re: Error about date function
Post by: datahell on September 28, 2016, 08:22:09
Why to set the timezone via htaccess? All dates in Elxis are saved in UTC/GMT timezone * (Greenwitch time). When you see a date Elxis display the date in your prefered timezone **, or if you have no personal preference, in the timezone set in Elxis general configuration ***.

If you get a warning about not defined default timezone contact your web hosting company and tell them to set the default value in server's php.ini
date.timezone = Asia/Taipei

* Elxis sets UTC as the default timezone in Elxis loader. includes/loader.php line 187:
date_default_timezone_set('UTC');

** includes/libraries/elxis/date.class.php line 59:
$this->datetime = new DateTime(NULL, new DateTimeZone($this->timezone));

*** includes/libraries/elxis/date.class.php line 41:
$this->timezone = eFactory::getElxis()->getConfig('TIMEZONE');
$this->datetime = new DateTime(NULL, new DateTimeZone($this->timezone)); //init datetime with local timezone
Title: Re: Error about date function
Post by: chongbing on September 28, 2016, 19:22:29
Thanks datahell,

Yes, I did as you said (as below), but it doesn't work. After set it in .htaccess following. It works. don't know why.
<IfModule mod_php5.c>
php_value date.timezone "Asia/Taipei"
</IfModule>

Quote
If you get a warning about not defined default timezone contact your web hosting company and tell them to set the default value in server's php.ini
date.timezone = Asia/Taipei

* Elxis sets UTC as the default timezone in Elxis loader. includes/loader.php line 187:
date_default_timezone_set('UTC');

** includes/libraries/elxis/date.class.php line 59:
$this->datetime = new DateTime(NULL, new DateTimeZone($this->timezone));

*** includes/libraries/elxis/date.class.php line 41:
$this->timezone = eFactory::getElxis()->getConfig('TIMEZONE');
$this->datetime = new DateTime(NULL, new DateTimeZone($this->timezone)); //init datetime with local timezone