php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54080 date.timezone in php.ini ignored
Submitted: 2011-02-23 15:39 UTC Modified: 2011-02-23 17:16 UTC
From: huan at huan dot pl Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.5 OS: Linux Debian 5.0
Private report: No CVE-ID: None
 [2011-02-23 15:39 UTC] huan at huan dot pl
Description:
------------
Value of "date.timezone" is being ignored and PHP uses US/Central all the time.

The system is set to use 'Europe/Warsaw' timezone and it shows the right time with 'date' command.

In php.ini I have:

--- CUT ---
[Date]
date.timezone = 'Europe/Warsaw'
--- CUT ---

But the result of the test script is:

Server timezone in php.ini is = US/Central

Location of php.ini is /usr/local/etc/php5/cgi/php.ini and I had modified the right php.ini, the value of date.timezone is just being ignored and I have no idea why it uses 'US/Central' since the whole system uses other timezone

Test script:
---------------
<?php

$script_tz = date_default_timezone_get();

if (strcmp($script_tz, ini_get('date.timezone'))) {
    echo "Script timezone differs from ini-set timezone.<br>\n";
    if (ini_get('date.timezone')=="") {
        echo "Server timezone in php.ini is = not set.";
    }else{
        echo "Server timezone in php.ini is = ".ini_get('date.timezone');
    }
} else {
    echo 'Script timezone and ini-set timezone match.';
}

        echo    date("d/m/Y H:i:s");

?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-23 15:41 UTC] huan at huan dot pl
> it shows the right time with 'date'
I meant 'date' command in shell
 [2011-02-23 15:42 UTC] huan at huan dot pl
> it shows the right time with 'date'

I meant 'date' command in shell
 [2011-02-23 15:43 UTC] derick@php.net
-Status: Open +Status: Feedback
 [2011-02-23 15:43 UTC] derick@php.net
Are you using Debian's packages?
 [2011-02-23 16:03 UTC] huan at huan dot pl
-Status: Feedback +Status: Open
 [2011-02-23 16:03 UTC] huan at huan dot pl
No, it has been compiled from source (downloaded from php.net).

Here is the output of phpinfo():
http://dl.dropbox.com/u/9277548/phpinfo.html
 [2011-02-23 16:09 UTC] huan at huan dot pl
/usr/local/etc/php5/cgi/php.ini:
http://dl.dropbox.com/u/9277548/php.ini
 [2011-02-23 17:16 UTC] derick@php.net
-Status: Open +Status: Bogus
 [2011-02-23 17:16 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Check the last line of your php.ini file, it says:

date.timezone = "US/Central"

;-)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC