This article shares with you the solutions to errors related to the PHP time function data(). Friends in need can refer to it
Today I am changing a method to filter data by time When connecting the interface, an error suddenly appeared inexplicably. I took a quick look and it was an error in the date() function. I was using the environment of
PHP5.6
+nginx1.10
, and the error message As follows:
date(): it is not safe to rely on the system's timezone settings.
Baidu, it is said on the Internet that this kind of error will be reported when it comes to time after PHP5.3, the best solution The solution is to modify the php.ini file. The modification method is as follows:
Open php.ini and find date.timezone
Under Linux and Mac systems, the location of the php.ini file is generally in the /usr/local/etc/php directory. If you cannot find it, you can use the whereis php.ini
command to find it. The window is usually in PHP. Under the installation directory
Modify date.timezone
Use the vim php.ini command to open the file and find date.timezone
Remove the ;
number in front and change it to date.timezone ="PRC"
, save and restart and it will be OK!
The above is the detailed content of 【php】Error related to time function date()!. For more information, please follow other related articles on the PHP Chinese website!