Sensei
- Join Date:
- Jan 2004
- Posts:
- 63,513
- Plugin Contributions:
- 176
date.timezone patch for v1.5.1/1.5.0/1.3.9 on PHP 5.3/5.4/5.5
PHP 5.3 changed the PHP configuration requirements for date/timezone handling, and tons of PHP servers are incorrectly configured with invalid (usually missing or number-based instead of name-based) timezones.
If you are getting the following error, you can fix it by creating your own patch files as described below:
Symptom:
PHP Warning: date() [function.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 'America/New_York' for 'EDT/-5.0/EST' instead in ...
Solution:
Place the following code into 2 NEW files you'll create on your server:
- /includes/extra_configures/datetime_patch_for_v151_or_older.php
- /YOUR_ADMIN_FOLDER/includes/extra_configures/datetime_patch_for_v151_or_older.php
NOTE: BOTH files require the same content:
<?php
/*
* Get time zone info from PHP config
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
@date_default_timezone_set(date_default_timezone_get());
}
IF THAT DOES NOT WORK, THEN ...
"Plan B" would be to replace date_default_timezone_get() above with your actual timezone like this:
@date_default_timezone_set('Europe/Oslo');
IF THAT STILL DOES NOT WORK ... THEN YOU HAVE A BIGGER SERVER PROBLEM!
If you continue to get errors related to date.timezone after following these instructions, then you must contact your hosting company for help in properly setting date.timezone in your server's PHP configuration. You will have to solve it with their help.
.
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.