Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to set the php time zone for linux server

Shulou Source: shulou.com Published: 2022-06-01 09:45:23 10月01日 Update

This article is about how the linux server sets the php time zone. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Setting method: 1, open the "/ etc/sysconfig/clock" file, change the value of the "ZONE" item to "Asia/Shanghai"; 2, execute the command to modify the system time zone; 3, open the "php.ini" file, and change the value of the "date.timezone" item to "PRC".

The operating environment of this tutorial: CentOS 6.5 system, PHP7.1 version, Dell G3 computer.

Modify linux time zone time and php time zone

The first step is to modify the hardware time zone.

Vim / etc/sysconfig/clock

Comment ZONE= "America/New_York" and add an extra line ZONE= "Asia/Shanghai"

Second, modify the system time zone

Cp / etc/localtime / etc/localtime.bakrm-rf / etc/localtimeln-svf / usr/share/zoneinfo/Asia/Shanghai / etc/localtimeyum install ntpdate-yntpdate 0.centos.pool.ntp.orgdateclock-w # write the current Linux time to BIOS! Clock-r # check the time in BIOS

The third step is to modify the time zone setting of php.ini

Date.timezone = PRC

After setting up, it is best to restart the system.

Thank you for reading! This is the end of the article on "how to set the php time zone on the linux server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Time zone system time server services content files more articles good practical one-line commands tutorials articles methods best comments environment computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Technology Shulou Tech Info OPPO Reno vpn