Forums

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

  1. jassu
    Member
    Posted 4 months ago #

    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.

  2. conceptify
    Member
    Posted 4 months ago #

    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

  3. jassu
    Member
    Posted 4 months ago #

    That seems to work, thought it's quite ugly fix :D

  4. Dan.LaSota
    Member
    Posted 4 months ago #

    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

  5. peter-b
    Member
    Posted 3 months ago #

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

  6. mrmist
    Member
    Posted 3 months ago #

    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.

  7. Dan.LaSota
    Member
    Posted 3 months ago #

    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.

  8. Otto42
    Moderator
    Posted 3 months ago #

    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.

  9. mrmist
    Member
    Posted 3 months ago #

    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.

  10. peter-b
    Member
    Posted 3 months ago #

    Thank you - I'll try it later.

  11. peter-b
    Member
    Posted 3 months ago #

    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!

  12. Otto42
    Moderator
    Posted 3 months ago #

    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.

  13. fukiburi
    Member
    Posted 3 months ago #

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

  14. ymasood
    Member
    Posted 3 months ago #

    conceptify thanks and your solution worked!

  15. crayaco
    Member
    Posted 3 months ago #

    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.

  16. stephaniemdavis
    Member
    Posted 3 months ago #

    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.

  17. peter-b
    Member
    Posted 2 months ago #

    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

  18. voody
    Member
    Posted 2 months ago #

    thank for this guide
    :=)

  19. zzzaccount
    Member
    Posted 1 month ago #

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

  20. patsar
    Member
    Posted 1 month ago #

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

  21. sarge117
    Member
    Posted 1 month ago #

    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!

Reply

You must log in to post.

About this Topic

Tags

No tags yet.