TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-23-2008, 11:13 PM   #1 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default Crazy Error... Fix it?

ERROR MESSAGE: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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/Denver' for 'MST/-7.0/no DST' instead

How do I fix that? Like, server setting-wise. (if thats the problem)
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 02-23-2008, 11:31 PM   #2 (permalink)
The Acquainted
 
Gareth's Avatar
 
Join Date: Jan 2008
Posts: 136
Thanks: 4
Gareth is on a distinguished road
Default

Can we see the code please?
Gareth is offline  
Reply With Quote
Old 02-23-2008, 11:53 PM   #3 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

[php]
<?php
date();
?>
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 02-24-2008, 12:02 AM   #4 (permalink)
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

Sounds like it's an issue with the date.timezone setting in your php.ini config file. In PHP 5 you can set this prior to using date() (as mentioned in the error message) with date_default_timezone_set() function.

Your code is still incorrect, however. You haven't passed a formatting parameter to date().
__________________
I reject your reality, and substitute my own.
SOCK is offline  
Reply With Quote
Old 02-24-2008, 12:02 AM   #5 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Did you or the server change anything about the timestamp (Apoch 1970)? If so, reset it. This is a totally not common error.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 02-26-2008, 12:24 AM   #6 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Infact it is a very common error PHP5 requires you to set the default timezone before using any date functions.

If you are unable to do this in your php.ini file, then you can use date_default_timezone_set() as Sock mentioned.

Example:

PHP Code:
date_default_timezone_set('Europe/London');
// ... your date() functions here ... 
Note about the default timezone requirement: PHP: date - Manual (see the Errors/Exception part)
List of supported timezones: PHP: List of Supported Timezones - Manual

And finally, attached is a PHP file with all the above timezones in an array. I use it to generate a <select> dropdown list to let the users set their own timezone.

Alan
Attached Files
File Type: php timeZoneList.php (18.8 KB, 195 views)
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following 4 Users Say Thank You to Alan @ CIT For This Useful Post:
Aaron (02-27-2008), DeMo (02-27-2008), ReSpawN (02-26-2008), SOCK (02-26-2008)
Old 02-26-2008, 06:36 PM   #7 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Awesome, another thing I didn't know. Thanks Alan
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:00 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design