How to change Default Timezone in VPS and Dedicated web hosting servers

By: Rajat Kumar | Last Updated: July 30, 2017

Background:

Hello techies today we are going to discuss about how to set or change Timezone in VPS and Dedicated web hosting servers. These all methods may works in different conditions and always effective if you may want to change or set your Timezone if you’re hosting server is not in your country or region.

In this section we are going to discuss some methods of how to change you web server default Timezone if you have VPS and Dedicated web hosting servers. These methods are the best practices to change time zone for PHP and Server as wall, so without wasting so much time let’s dive into main topic.

 

Why Correct Timezone Need?

That is a good discussions by many community that why we need our current country Timezone where from website is currently operating. I have a simple answer about this fact, just imagine that you booked a ticket from any travel booking site and get you ticket confirmation with booking number and correct date & time. At this time you may get different date & time in your ticket than you had chosen at booking time. This situation may make any customer confuse who not really know about that facts.

So as per commercial website purpose the Timezone should be correct as country wise to making business easy and simpler to every customers.

Note: it is not necessary to restart the server when changing the timezone. You will also not have the ability to do so in a shared hosting servers setting, since it will bring everyone's site down.

 

Set Timezone from cPanel WHM using PHP Editor (Method – 1):

If you have VPS and Dedicated Web Server than you have an ability to change default timezone by the desired one, to do so just follow the simple instructions:

  1. Login to your WHM account as root user.
  2. Now you can change PHP's time zone by clicking Home » Service Configuration » PHP Configuration Editor, and clicking the Advanced Mode radio button.
  3. Scroll down and find the setting to change is date.timezone. This applies to all sites on the server unless overridden by custom php.ini files.

 

Infographic steps:

Step-1: PHP Editor and go to advanced mode

php-editor-advanced-mode

 

 

Step-2: change America/Chicago to Asia/Kolkata

php-editor-advanced-mode-set-date-timezone

 

 

Step-3: save the change and refresh the website, great all done now you see the changes in your phpinfo file.

phpinfo

 

Set Server Timezone through Root Server in WHM (Method – 2):

This method is for those who have this feature allows you to set your server’s time zone and synchronize its time with your network's time server. You may synchronize your server to your network’s time server. This is useful if your server’s time is incorrect. To synchronize your server’s time with the network time server, click Sync Time with Time Server.

Just follow the simple steps to set your Time zone through .htaccess:

Step-1: Login to WHM as root.

Step-2: Go to Home >> Server Configuration >> Server Time

Step-3: From the dropdown menu, select the time zone you wish to change the server to.

Step-4: If you have noticed your server time is out of sync you can select the "Sync Time with Time Server" option. If your server is configured correctly this should rarely need to be done. This will resynchronize your server with the Time Server to display the correct time for the time zone you have selected.

 

Infographic steps:

Step-1: login to WHM as root and click to server configuration option.

whm-home

 

 

Step-2:  in next window click to server time.

server-config-home

 

 

Step-3: Select desired Timezone from drop-down box and click to Change TimeZone.

change-server-timezone

 

Step-4: Click to Sync Time with Time Server to synchronize time with all server activity.

Step-5: All done, just logout and see your server activity with current time zone as you set like: Log Files and Cron Jobs.

 

 

Conclusion:

All the techniques are tested in production environment so choose one of any technique can resolve you timezone change problem in shared hosting web server. If you have any other best technique please be share with us in comment section, and make the other newbies easy to learn environment.

 


If you find this article worth to you please hit kudos, comment your view, & share to your friends to make worth to us being writing technical articles. Thanks very much see you in next session.


 

Views