It is not safe to rely on the system's timezone settings

Source: Internet
Author: User
Tags php file upload

When writing a PHP File Upload program, the following warning is reported:

Upload: screen 2014-09-28_160214.png type: image/pngsize: 66.84765625 kbtemp file: D: \ Users \ Aven \ appdata \ Local \ temp \ php742f. tmpwarning: move_uploaded_file () [function. move-uploaded-file]: 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 F: \ PHP \ upload_file.php on line 26 warning: move_uploaded_file (upload/screen 2014-09-28_160214.png) [function. move-uploaded-file]: failed to open stream: no such file or directory in F: \ PHP \ upload_file.php on line 26 warning: move_uploaded_file () [function. move-uploaded-file]: 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 F: \ PHP \ upload_file.php on line 26 warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move 'd: \ Users \ Aven \ appdata \ Local \ temp \ php742f. TMP 'to 'upload/screen 2014-09-28_160214.png 'in F: \ PHP \ upload_file.php on line 26 stored in: Upload/screen 2014-09-28_160214.png
This is because the time taken by PHP is Greenwich mean time, so there will be a difference between the GMT Standard Time and the Beijing time by about eight hours. We can solve this problem as follows:
1. Use date_default_timezone_set () in the page header to set my default time zone to Beijing time, that is, <? PHP date_default_timezone_set ("PRC");?> You can.
2. in PHP. set date in ini. the value of timezone is PRC, and the value after setting is date. timezone = PRC, cancel the comments of this line of code at the same time, that is, remove the semicolon above.

Here we use the method of modifying the configuration file to solve the problem:

Use Notepad ++ to open PHP. ini,


Find "date. timezone", remove the semicolon before the statement, set the value to "PRC", restart the FastCGI service, and solve the problem.


It is not safe to rely on the system's timezone settings

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.