网站首页 说明书大全 范文大全 知识大全 实用查询
首页 > 知识大全 > 电脑知识 >

怎么在bios里设置时间(centos  php时间设置的方法)

修改 linux 时区时间和 php 时区

问题:

客户美国服务器时间不对

解决步骤:

第一步,先修改硬件时区。

vim /etc/sysconfig/clock将 ZONE="America/New_York" 注释,加多一行 ZONE="Asia/Shanghai"

第二步,修改系统时区

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         #将目前 Linux 的时间写到 BIOS 里面去!clock -r         #检查 BIOS 里面的时间

第三步,修改 php.ini 的时区设置

date.timezone = PRC

第四步,写个 crontab 将时间同步(特殊情况下,加上这个)

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

怎样设置每次开机同步一次时间

vim /etc/rc.localusr/sbin/ntpdate 0.centos.pool.ntp.org >/dev/null

上面是设置 centos6.5 的时区和时间的,下面说的是 centos7的

yum -y install ntpsystemctl enable ntpdntpdate -u cn.pool.ntp.orgsystemctl start ntpd#设置时区timedatectl set-timezone Asia/Shanghai

相关文章