It is not safe to rely on the system solution

Source: Internet
Author: User

There was a warning when PHP was debugged:

It's not safe for rely on the system workaround, in fact, the time zone setting is incorrect, this article provides 3 ways to solve this problem.

In fact, starting with PHP 5.1.0, when using a function such as date (), if the TIMEZONE setting is not correct, each time function is called, it will produce e_notice or e_warning information, and in PHP, Date.timezone This option is off by default, regardless of the PHP command is Greenwich Mean time, but PHP5.3 if you do not set a part of the time class function will be forced to throw the error.
PS: Now, because most people use vps/cloud host, the environment that needs to be configured by oneself is more likely to appear this situation.
Recommendation: not familiar with the PHP environment or with a more mature one-click Install package Bar.


Method 1:

(The best way) in php.ini to find the Date.timezone entry, set date.timezone = "Asia/shanghai", restart the environment is OK.


Method 2:

When these time functions are needed, add Date_default_timezone_set ("PRC") to the page;


Method 3:

In the header plus set the time zone Ini_set (' Date.timezone ', ' Asia/shanghai ');


Error code:
warning: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 ' asia/chongqing ' for ' cst/8.0/no DST ' instead

warning:strtotime (): 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 ' asia/chongqing ' for ' cst/8.0/no DST ' instead

warning:date_default_timezone_get (): 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 ' asia/chongqing ' for ' cst/8.0/no DST ' instead in <b>/home/ftp/n/nimaboke/include/lib/ function.base.php



It is not safe to rely on the system solution

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.