Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the method for centos to modify php time

Shulou Source: shulou.com Published: 2022-06-03 00:07:58 09月28日 Update

This article mainly explains "what is the method for centos to modify php time". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's way of thinking to study and learn "what is the method for centos to modify php time".

1, modify the hardware time zone; 2, modify the system time zone; 3, modify the time zone setting of php.ini; 4, synchronize the time through crontab.

Problem: the customer's US server time is incorrect.

The first step is to modify the hardware time zone.

Vim / etc/sysconfig/clock comments ZONE= "America/New_York" with 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

Step 4, write a crontab to synchronize the time (in special cases, add this)

# Ansible: Time synchronization00 01 * / usr/sbin/ntpdate 0.centos.pool.ntp.org > / dev/null

How to set the synchronization time for each boot

Vim / etc/rc.local usr/sbin/ntpdate 0.centos.pool.ntp.org > / dev/null

The above is to set the time zone and time of centos6.5, and the following is that of centos7

Yum-y install ntpsystemctl enable ntpdntpdate-u cn.pool.ntp.orgsystemctl start ntpd# set time zone timedatectl set-timezone Asia/Shanghai thank you for reading, the above is "what is the method of centos modifying php time", after the study of this article, I believe you have a deeper understanding of what is the method of centos to modify php time, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Time time zone method synchronization learning content situation hardware system problem no special line customer that is ideas articles more servers comments Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple Xiaomi MariaDB NVidia