WordPress.org

Support

Support » Installation » Php 5.3.0 & WP 2.8 (It is not safe to rely on the system’s timezone)

Php 5.3.0 & WP 2.8 (It is not safe to rely on the system’s timezone)

  • After upgrading webservers php 5.2.9 to new stable 5.3.0 wordpress started to give following errors to every page:

    ***
    Warning: strtotime() [function.strtotime]: 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/Helsinki’ for ‘EEST/3.0/DST’ instead in /path/to/my/www/wp-includes/functions.php on line 35

    Warning: date() [function.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/Helsinki’ for ‘EEST/3.0/DST’ instead in /path/to/my/www/wp-includes/functions.php on line 43

    Warning: strtotime() [function.strtotime]: 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/Helsinki’ for ‘EEST/3.0/DST’ instead in /path/to/my/www/wp-includes/functions.php on line 35

    Warning: date() [function.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/Helsinki’ for ‘EEST/3.0/DST’ instead in /path/to/my/www/wp-includes/functions.php on line 43
    ***

    Problem with php 5.3.0 or wordpress 2.8? I changed the timezone setting from properties to Europe-Helsinki (was GMT +3) without help.

Viewing 15 replies - 1 through 15 (of 32 total)
  • conceptify
    Member

    @conceptify

    I have run into the same issue and here is what I did to resolve it:

    In /wp/wp-includes/functions.php

    Add the following before the first function:

    date_default_timezone_set('UTC');

    Not sure if this is the best place to put this but some of the other places I tried it didn’t work or only worked for certain parts of WordPress

    That seems to work, thought it’s quite ugly fix 😀

    Another way to approach this is to let php know what your time zone is. You can edit your php.ini file and put in the following line:

    date.timezone = “America/Anchorage”

    You can find valid time zone strings at http://nl3.php.net/manual/en/timezones.php

    peter-b
    Member

    @peter-b

    Any update on this? I tried Dan’s fix but without success – I have just reverted back to PHP 5.2.8

    mrmist
    Forum Janitor

    @mrmist

    Dan LaSota posted the fix. This is a PHP change, not a WordPress change. PHP 5.3.0 needs the date.timezone ini entry setting properly in order to avoid the warning being sent out.

    Prior to PHP 5.3.0, the line existed in the PHP ini but was generally commented out.

    Depending on your setup you may need to restart your web services after making the change.

    Dan.LaSota
    Member

    @danlasota

    You should, of course, use the time zone you want, not necessarily “America/Anchorage”. Also I just installed apache/mysql/php3.0 on an entirely new machine, ran into the same problem and after adding the
    date.timezone = "America/Anchorage"
    to my php.ini file the problem went away.

    If you don’t have access to the php.ini, adding this to the top of the wp-config.php file will do much the same thing:

    date_default_timezone_set('America/Chicago');

    Use whatever timezone is appropriate for you, of course. List is here:
    http://us3.php.net/manual/en/timezones.php

    Note that this will not affect the timezone setting in WordPress. In fact, WordPress will override it. It just doesn’t set it early enough to avoid this warning. The best way is still to have a default set in the php.ini file.

    mrmist
    Forum Janitor

    @mrmist

    The best way is still to have a default set in the php.ini file.

    Indeed, and if a web host has provided 5.3.0 then they should really have put the timezone setting into the php.ini, as the lack of it would affect all their users. I’d be tempted to open a ticket if that were the case.

    peter-b
    Member

    @peter-b

    Thank you – I’ll try it later.

    peter-b
    Member

    @peter-b

    Okay, my /etc/php.ini file looks like this
    <—-snip

    [Date]
    ; Defines the default timezone used by the date functions
    ;
    ;
    date.timezone = “Europe/London”
    ;
    ;date.default_latitude = 31.7667
    ;date.default_longitude = 35.2333

    ;date.sunrise_zenith = 90.583333
    ;date.sunset_zenith = 90.583333

    snip—–>

    I have restarted Apache – still get

    Warning: strtotime() [function.strtotime]: 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/London’ for ‘BST/1.0/DST’ instead in /var/www/html/blog/wp-content/plugins/comment-timeout/comment-timeout.php on line 342

    repeated with different line numbers.

    Reverting back to 5.2.8!

    peter-b: Make sure that there’s not another php.ini file somewhere. mod_php for Apache frequently has its own php.ini that’s not in /etc.

    fukiburi
    Member

    @fukiburi

    thanks for posting the solution with the php.ini! it solved my problem perfectly 🙂

    ymasood
    Member

    @ymasood

    conceptify thanks and your solution worked!

    crayaco
    Member

    @crayaco

    Another way to approach this is to let php know what your time zone is. You can edit your php.ini file and put in the following line:

    date.timezone = “America/Anchorage”

    You can find valid time zone strings at http://nl3.php.net/manual/en/timezones.php

    Tried this and it fixed my problem. Thanks for solution.

    stephaniemdavis
    Participant

    @stephaniemdavis

    I am running XAMPP on a USB stick and encountered the same problem as mentioned above. Here’s what I did to fix it:

    First, I changed the “time zone” in my WordPress ‘Settings’ to ‘America/New York’.

    Next, I went to my XAMPP control panel and selected the ‘Setup’ button. For reasons unknown to me, I eventually reached a screen that automatically changed the “php.ini” setting to reflect the WordPress setting change mentioned above.

    Lastly, I shutdown both MySQL and Apache in my XAMPP control panel, restarted both and logged into my WordPress admin panel. Voila!!! everything is now fine.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Php 5.3.0 & WP 2.8 (It is not safe to rely on the system’s timezone)’ is closed to new replies.