Mktime () [Function.mktime]: It isn't safe to rely on the systems timezone settings problem solving

Source: Internet
Author: User
The following problems were encountered when deploying PHP code:

Strict Standards: Date_default_timezone_get () [Function.date-default-timezone-get]: It isn't safe to rely on the system ' s timezone settings. Please use the Date.timezone setting, the TZ environment variable or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected ' UTC ' for ' 8.0/no DST ' instead inC:\AppServ\www\nipin\configs\config.php on line -
Strict Standards: Mktime () [Function.mktime]: It isn't safe to rely on the system ' s timezone settings. Please use the Date.timezone setting, the TZ environment variable or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected ' UTC ' for ' 8.0/no DST ' instead inC:\AppServ\www\nipin\configs\config.php on line -
Strict Standards: Mktime () [Function.mktime]: You should is using the time () function instead inC:\AppServ\www\nipin\configs\config.php on line -

The reason is that PHP to get GMT and Beijing time difference 8 hours, should take Beijing time.

Original above error, mainly reflected in a sentence:

$getime = date_default_timezone_get () = = ' UTC '? Mktime () +28800:mktime ();

There are two ways to solve this problem:

1, is to add this sentence directly to replace the above sentence, Date_default_timezone_set ("PRC"); directly set to background time.

2, in the php.ini file, set:;d Ate.timezone = Asia/shanghai or DATE.TIMEZONE=PRC

The above describes the Mktime () [Function.mktime]: It is not safe to rely on the systems timezone settings problem resolution, including aspects of the content, want to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.