Zen Cart Logo
Forums / General Questions / A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

Views: 2,039

Results 1 to 6 of 6
5 Jun 2015, 3:56 AM
#1
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

There are two zencarts on this server

1.39h runs fine

1.53 not so much
I get this error when trying to access the admin page

Warning: strtotime() [function.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 'UTC' for 'AWST/8.0/no DST' instead in /home/example/public_html/example/login.php on line 13
I have read and followed the below (post 2 part c for zen 1.53)
https://www.zen-cart.com/showthread.php?208662-date-timezone-patch-for-v1-5-1-1-5-0-1-3-9-on-PHP-5-3-5-4-5-5

and that has made no effect whatsoever to the login error, although the new timezone added does appear (with the correct time) in the green menu bar in admin, so it isn't misspelled.

Steps to get into zen 1.53 (because I think my post may be confusing)

  1. go to my admin page, presented with the above Warning message above my login box
  2. I put in my login credentials hit enter
  3. presented with a blank page with only the warning message on it no login box, no admin page
  4. In my address bar delete the /login.php part of the URL address and then press enter
  5. Admin page appears and works fine

Note the 1.39h store admin on the same server account works perfectly no login issues

Webzings Design
Semi retired from Web Design

5 Jun 2015, 4:17 AM
#2
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

Knew i forgot something

PHP Version 5.3.29

Webzings Design
Semi retired from Web Design

5 Jun 2015, 4:18 AM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

nigelt74:

I get this error when trying to access the admin page

That isn't an error, it is a warning. As a general rule a warning will have no other ill effects, so you could be barking up the wrong tree.

What does raise a bit of an alem though is this
* "We selected 'UTC' for 'AWST/8.0/no DST' instead in /home/example/public_html/example/login.php on line 13"

*The /home/example/public_html/ looks positively wrong. Not saying it is wrong, but it certainly isn't 'normal'

I would hazard a guess and suggest that this seemingly erroneous path is being derived from the settings in your configuration file(s).

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

5 Jun 2015, 4:32 AM
#4
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

Hi RodG

Nope thats my fault in obfuscating the paths, I shouldn't have used example for both thingies

/home/example/public_html/example/login.php

should be

/home/site-account/public_html/secret-admin/login.php

anyway it seems to be working now I added the following line

date.timezone = "Australia/West"

to the php.ini file, and no errors appear and login is smooth as a smooth thing

Just have to monitor that hasn't caused any other issues

Cheers

Webzings Design
Semi retired from Web Design

5 Jun 2015, 8:17 PM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

nigelt74:

Hi RodG
Nope thats my fault in obfuscating the paths, I shouldn't have used example for both thingies

Well, that certainly made diagnosis of the problem so much easier didn't it. <gggrrrrrrr> <smile>

nigelt74:

Just have to monitor that hasn't caused any other issues

No, that won't cause any other issues at all. That is one of several viable and valid methods of setting the PHP timezone. (Not all methods are suitable for all server configurations, but whichever method is used/tried it will either work or not work, and when it works it will work 'correctly' with no further repercussions.

Only one 'teeny' thing to consider is that this setting only affects the timezone that PHP uses. Your SQL database could be in a different timezone, and the server itself in yet another timezone. These different timezones don't affect functionality of anything in any way, but it is something to be aware of if/when setting up 'cron' jobs and/or reviewing any log files.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

9 Jun 2015, 3:54 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: A different - Warning: strtotime() [function.strtotime]: It is not safe to rely

v139 doesn't do anything with timezones at all.
v153 had code in it to attempt to help keep both server and db timezones in sync regardless of server admin errors, but PHP 5.3 did some different stuff.
v1.5.4 should have it "right" now, as long as you set your timezone in the extra_datafiles file.

.
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.