warning with date

I use the last version of xampp with php 5.3.

I make use of access rules and I tried to login.

So I have this warning, what have I to do? It is for xdebug.

Like the message says: Try to set the timezone in your php.ini file:


date.timezone='Europe/Helsinki';



I actually have the same problem with PHP 5.3 and setting date.timezone in the "php.ini"-file does not make any difference for me (bug in PHP?). However, using date_default_timezone_set() on top of my index.php works.

Greetings from Rostock / Germany

  • rojaro -

These days I made a small project with cakephp and I had also the same problem.

Actually at php.ini there where no time-zone, I put it and the problem of Yii project solved but I read the comments of cakephp 1.2.5 to set (at a config file as I remember-not remembering the file) the time zone if using php 5.3

has to work when put in php.ini (using this myself with PHP 5.3). Based on the installation you may have 2 php.ini files - 1 for fcgi/apache-module and 1 for the cli.

I actually use php-cgi running as FastCGI in LightTPD and using strace i can see that php-cgi loads the correct php.ini file, but anyway, the configuration directive does not work for me.


lingling ~ # grep timezone /etc/php/cgi-php5/php.ini 

; Defines the default timezone used by the date functions

; http://php.net/date.timezone

date.timezone = "Europe/Berlin"

lingling ~ # strace php-cgi -v 2>&1 | grep php.ini

open("./php.ini", O_RDONLY)             = -1 ENOENT (No such file or directory)

open("/usr/lib64/php5/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/etc/php/cgi-php5/php.ini", O_RDONLY) = 3

lstat("/etc/php/cgi-php5/php.ini", {st_mode=S_IFREG|0644, st_size=68833, ...}) = 0

lingling ~ # echo "<?php echo date('Ymd'); ?>" | php-cgi

PHP 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 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/users/rojaro/- on line 1

Content-type: text/html




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 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/users/rojaro/- on line 1

20090918lingling ~ #

Strange? Yep … but well, i havent had the time yet to do some real debugging … maybe later next week …

date_default_timezone_set() works just fine …

Greetings from Rostock / Germany

  • rojaro -

Hm yeah that is strange. I use lighty+fcgi as well and have no problems regarding this. :huh: