Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify php time with centos

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to modify php time with centos". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to modify php time with centos.

Centos modifies php time: 1, modify hardware time zone; 2, modify system time zone; 3, modify php.ini time zone setting; 4, synchronize time through crontab.

This article operating environment: centos6.5 system, PHP7.1 version, DELL G3 computer

How does centos modify php time?

Modify linux time zone time and php time zone

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

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

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.localusr/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# setting time zone timedatectl set-timezone Asia/Shanghai so far, I believe you have a deeper understanding of "how to modify php time with centos". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report