Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...