Home >Backend Development >PHP Problem >How to solve linux php date error problem
Solution to Linux php date error: 1. Determine whether the Linux system time is correct; 2. Check the time zone in php.ini; 3. Find ";date.timezone=" and add "Asia/ Shanghai" is enough.
The operating environment of this article: linux5.9.8 system, PHP7.1 version, DELL G3 computer
How to solve linux php date error Problem?
Linux error resolution related to PHP time function
Recently, I have written a lot of functions date() strtotime(), etc. to obtain time or timestamp in the program, but When the program was run on Linux, errors in these functions occurred. The specific reason was due to the time setting of Linux itself and the time zone problem of PHP.
First make sure the linux system time is correct:
Change the time zone to Shanghai, China
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Then check the time zone in php.ini
Find ;date.timezone=
Remove the semicolon, and then add Asia/Shanghai
Recommended learning: "PHP Video Tutorial》
The above is the detailed content of How to solve linux php date error problem. For more information, please follow other related articles on the PHP Chinese website!