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 - 16 through 30 (of 32 total)
  • Ok – I have only one PHP.ini file that I can find on my system (locate php.ini) which has been edited as above. I have rebooted the system after installing php5.3 – and I still get the same errors.

    The timezone in WordPress settings is set to London (although it still shows times as BST and DST – is that correct?

    Looks like I’ll be sticking with php 5.2.8

    thank for this guide
    :=)

    Thanks conceptify,
    Modifying the functions.php didi it for me

    Thanks a lot.
    Editing the php.ini solve the problem.

    Thank you so much, this one php.ini line solved my problems, and i am using xampp on a usb stick.

    FYI php.ini on xampp >

    /xampp/php/php.ini

    ctrl+F > find “date.t”

    delete the whole line [including ;] < very important

    replace with: date.timezone = “Europe/London”

    [or another timezone]

    dont forget to restart xampp!

    Cheers!

    web-runner

    @web-runner

    conceptify It works! Regards from Buenos Aires

    @ Conceptify Thanks!

    date_default_timezone_set('Europe/Moscow');

    in wp-includes/functions.php did the trick. Still, it would be better to have used a fix that did not involve changing a WordPress core file.
    The timezone indicated in my php.ini seems to be the correct one

    date.timezone = "Europe/Moscow"

    But WordPress does not want to rely on the System’s timezone..

    jboontje

    @jboontje

    Thanks a bunch Conceptify, I almost freaked out as I never updated WordPress before.

    How can they forget about such an easy line of code on an upgrade.. seriously.

    iifolioDesign

    @iifoliodesign

    By editing the php.ini works beautiful.

    Thanks so much

    yablokitay.ru

    @yablokitayru

    Thanks

    i do not see an explanation as to why the editing php.ini would not fix it. i agree, changing functions.php or even the config file is not ideal. can anyone shed light on that please?

    Thanks a lot guys for information i’ve fixed the problem date.timezone = “Europe/Moscow”

    I do not understand why it is better to modify php.ini instead of adding the date_default_timezone_set() function in the WordPress core. From the description of date_default_timezone_get(), the highest in the preference is “Reading the timezone set using the date_default_timezone_set() function (if any)”. And it makes sense since it would not be wise to rely on the system’s php.ini settings for the timezone. Yes, it would be better if the directive for date.timezone is set but WordPress, or any PHP project, should rely on the directive being set. It might be better to add a configurable variable with a default value set for the date_default_timezone_set() function.

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    I do not understand why it is better to modify php.ini instead of adding the date_default_timezone_set() function in the WordPress core.

    You can do what you like (as I’m sure you know) but this us a PHP 5.3.0 issue and not a WordPress issue. Putting it into php.ini, if you can, sets the timezone for your PHP install.

    If you can’t edit php.ini, putting it into WordPress is a good tactical work around.

    And it makes sense since it would not be wise to rely on the system’s php.ini settings for the timezone.

    Why not? Relying on the system timezone never let me down before. I’m running php 5.3.2 and echo date(DATE_RFC822); works fine for me. I didn’t set the timezone explicitly anywhere.

    You can do what you like (as I’m sure you know) but this us a PHP 5.3.0 issue and not a WordPress issue.

    Actually, it’s both, since WordPress is using PHP and is affected by its changes.

    Yes, I agree that we can do what we like, but in this case it would only mean fixing the problem every time a WordPress installation breaks when PHP is upgraded *pointing to the original problem*.

    Why not?

    Again, it risks breaking (or at least messing up) existing WordPress installations when PHP is upgraded by someone who is not aware that doing so needs modifying of the date.timezone directive. Placing the date_default_timezone_set() function on the core makes WordPress installations more sturdy. When I say putting it in the core, I mean making it available for the next release without us having to modify our WP installations anymore.

Viewing 15 replies - 16 through 30 (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.
Skip to toolbar