This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9319|Reply: 0

PHP Warning: phpinfo(): It is not safe to rely on the system's timezone setting

[Copy link]
Posted on 2/3/2015 10:54:37 AM | | |

php default error log path: C:\Windows\Temp\php-errors.log, often look at it, it can help you find many potential problems, maybe these problems do not affect normal operation.

Error description:
PHP Warning:  phpinfo(): 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 'UTC' for '8.0/no DST' instead in C:\info.php on line 4

Solution:

Open the php.ini profile
Found it
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
; date.timezone =


Modified to:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =PRC


Then remember to restart Apache!

In addition, there are two methods (not recommended)

1. Use date_default_timezone_set() to set date_default_timezone_set('PRC') in the header; East 8 time zone echo date('Y-m-d H:i:s');

2. Use ini_set ('date.timezone','Asia/Shanghai') in the header;

For China, optional values: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (Chongqing, Shanghai, Urumqi) Available in Hong Kong and Taiwan: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (Macau, Hong Kong, Taipei), and Singapore: Asia/Singapore, as well as the old PRC.




Previous:php test code phpinfo() gives the following error:
Next:The Internet exposed the App Store sweeping studio: nearly 100 iPhone6 mobile phones are put together
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com