Changing Time zone in CentOS server/ Cpanel/WHM Servers
Option :1
Option 2:
Editing the configuration Files
Option :1
Main >> Service Configuration >> PHP Configuration Editor [Date and Time] we can change
Changing the time in VPS via WHM Main >> Server Configuration >> Server Time,Option 2:
Editing the configuration Files
#cat /etc/sysconfig/clock
date.timezone="US/Chicago"
date.timezone="America/Chicago"
[~]# cat /etc/sysconfig/clock
ZONE="US/Central"
UTC=false
ARC=false
ZONE="US/Central"
UTC=false
ARC=false
Option 3:
# ls -la /etc/localtime
# cp /etc/localtime /etc/localtime.bkp
# cp /usr/share/zoneinfo/America/Chicago /etc/localtime
Or
# ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
And then update the time zone value in your php.ini file
date.timezone="America/Chicago"
Restart the apache and check your server time.
Option 3:
Sometimes if your server is vps then the above options will not be work , for that time you can do the following steps.
1. Directly set the time using the date command, You can get the right time from your other server.
date --set="2012-10-17 21:34 am"
and if it throws "step-systime operation not permitted" error please fix this issue from your Hardware Node.
# vzctl stop VEID
# vzctl set --capability sys_time:on --save
# vzctl set
# vzctl restart VEID
date --set="2012-10-17 21:34 am"
Another fix:
yum -y install ntp
Identify time zone from http://www.pool.ntp.org/
# vi /etc/ntp.conf
select a server.
eg: 0.centos.pool.ntp.org
# ntpdate servername
That is ntpdate clock.rethat.com
While doing the ntpupdate you may receive the following error: "step-systime operation not permitted"
Suggested Fix
# vzctl stopVEID
# vzctl set --capability sys_time:on --save
needs to be replaced by your container’s ID
After executing the command above, your container’s configuration file needs to be reloaded. Thus, use ‘vzctl‘ to restart it.
# vzctl restart
Identify time zone from http://www.pool.ntp.org/
# vi /etc/ntp.conf
select a server.
eg: 0.centos.pool.ntp.org
# ntpdate servername
That is ntpdate clock.rethat.com
While doing the ntpupdate you may receive the following error: "step-systime operation not permitted"
Suggested Fix
# vzctl stop
# vzctl set
After executing the command above, your container’s configuration file needs to be reloaded. Thus, use ‘vzctl‘ to restart it.
# vzctl restart