How to solve linux php date error problem

藏色散人
Release: 2023-03-13 11:48:01
Original
2024 people have browsed it

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.

How to solve linux php date error problem

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template