Guide for changing TimeZone of WHM/cPanel Server

Category : cPanel/WHM

Hello,
Today we will show you the Guide for changing TimeZone of Server using cPanel / WHM. The steps are very simple to follow, we will include screenshots as well for demonstration.

Requirements

  • WHM / cPanel installed on Server with its credentials.
  • Root SSH Access to MySQL Server

Procedure

Change TimeZone in WHM
This will change TimeZone for all cPanel users and all websites hosted on it.

  1. Login to WHM using the credentials
  2. Look for “Server Configuration” Section or Search in search bar on left pane and tap on it
  3. Click on “Server Time” option as shown in screenshot below
  4. Select the appropriate timezone that you want on your server from drop-down list shown below
  5. Click on the “Change TimeZone” button.
    Note- If you doubt that time shown is incorrect then use “Sync Time with Time Server” option to fix it.
  6. If WHM asks to reboot the server then please perform a server reboot from WHM itself.

Change TimeZone for Particular Website or All Websites in PHP INI Manager

    1. Login to your cPanel Account
    2. Search or locate “MultiPHP INI Editor” and open it.
    3. Select Editor Mode Tab
    4. Tap on “Select a location” option

      Here you will find “Home Directory” and List on domains in your cPanel account.
      Making Changes in Home Directory will change for all the domains while making changes for the domain will change only for that domain and rest are unaffected and will follow Global TimeZone Settings.
    5. We will select domain some-domain.com domain from list.
    6. Text Editor Opens for us on the screen. We will type below for IST TimeZone.

      date.timezone = “Asia/Kolkata”

      You can find list of timezones here.

    7. Press save button.
    8. Create test.php inside your domain directory and add following code and save file.

      <?php

      // Show all information, defaults to INFO_ALL
      phpinfo();

      ?>

    9. Now open browser and open some-domain.com/test.php and you can see as following if steps followed correctly.

Change TimeZone for MySQL Server

  1. Login to root via SSH where MySQL Server is hosted.
  2. Run this command in terminal and enter password when prompts

    mysql -p -e “SELECT @@global.time_zone;”


    SYSTEM here means MySQL is using default TimeZone as Servers TimeZone.

  3. Check data for server using date command

    date

  4. Check MySQL Server Time using following command

    mysql -p -e “SELECT NOW();”

  5. Now edit configuration file for MySQL /etc/my.cnf and add it under [mysqld] section not [mysqld_safe]

    default-time-zone = ‘Asia/Calcutta’

  6. Restart MySQL Server

    sudo service mysqld restart

  7. Now check timezone for MySQL Server

    mysql -p -e “SELECT @@global.time_zone;”

  8. Now check MySQL Server Time using following command

    mysql -p -e “SELECT NOW();”

Hope this brief guide will help you changing TimeZone for WHM/cPanel, For Specific Website for User and for MySQL Server.