PHP problem--it is not safe for rely on the system ' s

Source: Internet
Author: User
Tags local time

1.1 It isn't safe to rely on the system ' s timezone settings1.1.1 phenomenon

To run the PHP application, the following error message appears:

Date (): It is not safe for rely on the system ' s timezone settings. You is *required* to use the Date.timezone setting 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 the timezone ' UTC ' for now, but please set Date.timezone to select your timezone.

1.1.2 Reasons

This is because the time taken by PHP is Greenwich Mean time, so it is about 8 hours or so of Greenwich Standard Time and Beijing time for your local time.

1.1.3 Solution

We can solve the following methods as follows:

1. Use Date_default_timezone_set () in the header to set my default time zone to Beijing time, i.e. <?phpdate_default_timezone_set ("PRC"); > It's ready.

2, set the value of Date.timezone in php.ini to PRC, set the following as: DATE.TIMEZONE=PRC, while canceling the comment of this line of code, that is, to remove the preceding semicolon is OK.

This article is from the "Rainman" blog, make sure to keep this source http://lancelot.blog.51cto.com/393579/1772959

PHP problem--it is not safe for rely on the system ' s

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.