Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php5.3.3 date.timezone again php.ini directive not taken into account

Tags:

date

timezone

php

System: Debian Lenny/Apache 2.2/php5.3.3 compiled from sources

I'm strugglying with the date.timezone within php.ini.

I can define the TZ using in the php source code but I'd like to fix that at once in the ini file.

php code : Ok

date_default_timezone_set('Europe/Berlin');

php.ini : Not taken into consideration if not setup within the source code

date.timezone = 'Europe/Berlin'

I also checked that I modified the right php.ini file and have interference with some php.default.ini files.
I checked within the apache config files whether there would be an interfering TZ env data, but none.

Don't know what to do more, so any hints will be welcomed,

thx in advance.

EDIT: I also tried with no or single or double quotes as date.timezone = 'Europe/Berlin' but I still get a "no value" in the phpinfo.

EDIT2: Both phpinfo() and the below test script return that the date.timezone is empty (eg. no value) :

 date_default_timezone_set('America/Los_Angeles');
 $script_tz = date_default_timezone_get();
 $iniset = ini_get('date.timezone') ;
 if (strcmp($script_tz, $iniset)){
   echo "Script timezone ($script_tz) differs from ini-set timezone ($initset).";
 } else {
   echo "Script timezone ($script_tz) and ini-set timezone match.";
 }

EDIT3: hum, I guess I found sthg in the php.ini :

 Configuration File (php.ini) Path : /usr/local/php533/php.ini 
 Loaded Configuration File : VOID !

So I have to find the way to make sure Apache is looking for the right php.ini somehow...

like image 538
hornetbzz Avatar asked Jun 22 '11 00:06

hornetbzz


People also ask

What is PHP default timezone?

The default timezone for PHP is UTC regardless of your server's timezone. This is the timezone used by all PHP date/time functions in your scripts.


1 Answers

I think you're missing the quotes:

date.timezone = "Europe/Berlin"

The value is a string according to: ini.date.timezone on PHP.net which must be wrapped in quotes.

like image 193
tplaner Avatar answered Oct 19 '22 22:10

tplaner