Forums / General Questions / Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Views: 1,405

Results 1 to 14 of 14
4 Feb 2016, 3:04 PM
#1
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Hi

I have just installed a copy of zencart on my server that is Linux based.

After the installation i have removed the ZC_Install folder as requested.

Then the admin folder was renamed too.

When i goto login into my admin i get this error :

Warning: strtotime(): 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 /websites/123reg/LinuxPackage22/fa/tm/oo/TEST.com/public_html/TEST A/TEST/login.php on line 13

Now, i am not sure what the issue is and how i can fix this... any ideas ??

By the way, i have used the same sever to run other zencart sites with NO issues.

Thank you

4 Feb 2016, 4:11 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

You'll need to edit the file /includes/extra_configures/set_time_zone.php, adding your time-zone in the spot indicated. Check here (http://us.php.net/manual/en/timezones.europe.php) for the supported constants in Europe, e.g. 'Europe/London':

<?php
/**
 * @package initSystem
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $
 */
/*
 * Set time zone
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
  // put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
  $TZ = '';  // eg: 'Europe/Oslo'



  /**
   * MAKE NO CHANGES BELOW THIS LINE
   *
   * The following will take the timezone you specified above and apply it in your store.
   * If you didn't specify one, it will try to use the setting from your server's PHP configuration
   */
  if ($TZ == '') {
    $TZ = date_default_timezone_get();
  }
  if ($TZ != '') {
    putenv('TZ=' . $TZ);
    @date_default_timezone_set($TZ);
  }
}

The same timezone setting will be used for your Zen Cart admin-console.

4 Feb 2016, 5:17 PM
#3
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

hi

thank you for your reply
sorry to ask you this but where would the time zone go in the script ?

would it be like this ??? ---->>

<?php /** * @package initSystem * @copyright Copyright 2003-2013 Zen Cart Development Team * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version GIT: $Id: Author: DrByte Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $ */ /* * Set time zone */ if (version_compare(PHP_VERSION, 5.3, '>=')) { // put your timezone here. Refer to <http://www.php.net/manual/en/timezones.php> $TZ = ''; // eg: 'Europe/London' Where my time zone is Europe/London Thank you
4 Feb 2016, 5:36 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Edit the file, adding your timezone as highlighted below:

<?php
/**
 * @package initSystem
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $
 */
/*
 * Set time zone
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
  // put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
  $TZ = '[B]Europe/London[/B]';  // eg: 'Europe/Oslo'



  /**
   * MAKE NO CHANGES BELOW THIS LINE
   *
   * The following will take the timezone you specified above and apply it in your store.
   * If you didn't specify one, it will try to use the setting from your server's PHP configuration
   */
  if ($TZ == '') {
    $TZ = date_default_timezone_get();
  }
  if ($TZ != '') {
    putenv('TZ=' . $TZ);
    @date_default_timezone_set($TZ);
  }
}
4 Feb 2016, 5:37 PM
#5
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Set like this

<?php
/**
 * @package initSystem
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $
 */
/*
 * Set time zone
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
  // put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
  $TZ = 'Europe/London';  // eg: 'Europe/London'
5 Feb 2016, 10:41 AM
#6
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Thank you for all your help.... much appreciated.

However, even after making the changes i am still getting this error message after i log in to the admin area...

Warning: strtotime(): 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 /websites/123reg/LinuxPackage22/fa/tm/oo/TEST.com/public_html/TEST A/Testadmin/login.php on line 13

My file that i have edited is located at : includes/extra configures/set_time_zone.php

the contents of the file are :

<?php
/**
 * @package initSystem
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @license [URL]http://www.zen-cart.com/license/2_0.txt[/URL] GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $
 */
/*
 * Set time zone
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
  // put your timezone here. Refer to [URL]http://www.php.net/manual/en/timezones.php[/URL]
  $TZ = 'Europe/London';  // eg: 'Europe/Oslo'



  /**
   * MAKE NO CHANGES BELOW THIS LINE
   *
   * The following will take the timezone you specified above and apply it in your store.
   * If you didn't specify one, it will try to use the setting from your server's PHP configuration
   */
  if ($TZ == '') {
    $TZ = date_default_timezone_get();
  }
  if ($TZ != '') {
    putenv('TZ=' . $TZ);
    @date_default_timezone_set($TZ);
  }
}

I am sure that i have followed the instructions but still this error is causing me issues.

Thanks for your help.

5 Feb 2016, 11:54 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

What version of PHP is beng used/seen by the cart as reported n the admin's version information screen?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

5 Feb 2016, 12:01 PM
#8
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

hi there

my Php version is 5.3

thanks

5 Feb 2016, 12:20 PM
#9
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

just changed my php version to php v 5.5

still the same error message

thanks

amebb:

hi there

my Php version is 5.3

thanks

5 Feb 2016, 1:36 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Is the file /YOUR_ADMIN/includes/extra_configures/use_catalog_time_zone.php present in your store's file-system?

5 Feb 2016, 2:56 PM
#11
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

lat9:

Is the file /YOUR_ADMIN/includes/extra_configures/use_catalog_time_zone.php present in your store's file-system?

Hi there
yes i have had a look at the file. its where it should be.

the contents of the file look like this :
**

<?php /** * @package admin * @copyright Copyright 2003-2013 Zen Cart Development Team * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version GIT: $Id: Author: DrByte Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $ */ // get time zone settings from catalog-side file include (DIR_FS_CATALOG . '/includes/extra_configures/set_time_zone.php');** Thanks
5 Feb 2016, 3:22 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

Are there any debug-log files in your store's /logs folder? Who is your web-host?

5 Feb 2016, 3:37 PM
#13
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

My Host is 123-reg (https://www.123-reg.co.uk)

my last log file is whats below...

[05-Feb-2016 12:16:13 Europe/London] PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/adminTESTAA/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/includes/functions/sessions.php on line 115

[05-Feb-2016 12:16:13 Europe/London] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/adminTESTAA/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/includes/functions/sessions.php on line 115

[05-Feb-2016 12:16:13 Europe/London] PHP Warning: Cannot modify header information - headers already sent by (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/adminTESTAA/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/TESTAA.com/public_html/TEST A/adminTESTAA/includes/functions/general.php on line 26

Hope that helps ?

8 Feb 2016, 4:13 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Warning: strtotime(): It is not safe to rely on the system's timezone settings.

amebb:

When i goto login into my admin i get this error :

Warning: ... /login.php on line 13
Given that it's happening only on the login page, it looks like you're tripping over a bug in your version of Zen Cart.
Simple fix here: https://www.zen-cart.com/showthread.php?215694-Known-Bugs-%28and-fixes%29-with-v1-5-4&p=1296793#post1296793

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.