Difference between revisions of "Changing Timezone"

From WHMCS Documentation

m (Timezone the cron operates under)
Line 1: Line 1:
 
===Setting the timezone WHMCS uses===
 
===Setting the timezone WHMCS uses===
The time under which your WHMCS installation will run is based upon the server clock and the timezone setting in your PHP configuration. Therefore to change the time displayed in WHMCS there are two options:
+
The time under which your WHMCS installation will run is based on the server clock and the timezone setting in your PHP configuration. To change the time in WHMCS there are two options:
  
 
#Change the server clock directly
 
#Change the server clock directly
 
#Edit the PHP configuration specifying a different timezone.
 
#Edit the PHP configuration specifying a different timezone.
  
Changing the server clock may not be desirable if clients are hosted on the server and would require root access, so option 2 is the most viable for the majority  of users. A number of hosting providers allow the PHP configuration to be changed on an individual directory by creating a php.ini file within the WHMCS directory. In that situation the following line could be added:
+
Changing the server clock may not be desirable if you host clients on the server. It also requires root access, so option 2 is the most viable for the majority  of users. A number of hosting providers allow you to change the PHP configuration on an individual directory by creating a php.ini file within the WHMCS directory. In that situation, you could add the following line:
  
 
<source lang="php">
 
<source lang="php">
Line 11: Line 11:
 
</source>
 
</source>
  
For a full list of the available timezone localities you can use, please refer to http://www.php.net/manual/en/timezones.php
+
For a full list of the available timezone localities you can use, see [http://www.php.net/manual/en/timezones.php the PHP list of timezones].
  
Please contact your hosting provider/server admin if you are unsure how to customise the PHP configuration of your server.
+
Contact your hosting provider or server administrator if you are unsure of how to customise the PHP configuration of your server.
  
 
===Timezone the cron operates under===
 
===Timezone the cron operates under===
In most cases, the PHP configuration for your WHMCS installation is different than that used for the command line. It is therefore important to ensure the timezone set in the PHP configuration WHMCS uses is the same as the one set in the PHP configuration the command line uses, and by extension the PHP configuration the cron is using.
+
In most cases, the PHP configuration for your WHMCS installation is different than the one that you use on the command line. It is therefore important to ensure the timezone in the PHP configuration WHMCS uses is the same as the one in the PHP configuration the command line uses, and by extension the PHP configuration the cron job is using.
 +
 
 +
If this is different, you will find that your cron job is executing at an unexpected or different time from the setting at 'Setup -> Automation Settings'. To check this, run the following command at the server command line while logged in as the same user under which the cron job is running:
  
If this is different, you will find that your cron is executing at an unexpected or different time to that which you expect it to and is set at 'Setup -> Automation Settings'. To check this, run the following command at the server command line whilst logged in as the same user under which the cron job is running:
 
 
<source lang="php">
 
<source lang="php">
 
php -ini | grep "date.timezone"
 
php -ini | grep "date.timezone"
 
</source>
 
</source>
You can compare the output of this command to the 'date.timezone' set in the PHP configuration your WHMCS installation is using by navigating to 'Utilities -> System -> PHP Info'. If they are different, you will need to work with your hosting provider or server administrator to set the same 'date.timezone' in the PHP configuration your WHMCS installation is using and the one used for the command line on the server.
+
 
 +
You can compare the output of this command to the 'date.timezone' set in the PHP configuration your WHMCS installation is using by navigating to 'Utilities -> System -> PHP Info'. If they are different, you will need to work with your hosting provider or server administrator to set the same 'date.timezone' in the PHP configuration your WHMCS installation is using and the one for the command line on the server.

Revision as of 20:58, 11 May 2020

Setting the timezone WHMCS uses

The time under which your WHMCS installation will run is based on the server clock and the timezone setting in your PHP configuration. To change the time in WHMCS there are two options:

  1. Change the server clock directly
  2. Edit the PHP configuration specifying a different timezone.

Changing the server clock may not be desirable if you host clients on the server. It also requires root access, so option 2 is the most viable for the majority of users. A number of hosting providers allow you to change the PHP configuration on an individual directory by creating a php.ini file within the WHMCS directory. In that situation, you could add the following line:

date.timezone=Europe/London

For a full list of the available timezone localities you can use, see the PHP list of timezones.

Contact your hosting provider or server administrator if you are unsure of how to customise the PHP configuration of your server.

Timezone the cron operates under

In most cases, the PHP configuration for your WHMCS installation is different than the one that you use on the command line. It is therefore important to ensure the timezone in the PHP configuration WHMCS uses is the same as the one in the PHP configuration the command line uses, and by extension the PHP configuration the cron job is using.

If this is different, you will find that your cron job is executing at an unexpected or different time from the setting at 'Setup -> Automation Settings'. To check this, run the following command at the server command line while logged in as the same user under which the cron job is running:

php -ini | grep "date.timezone"

You can compare the output of this command to the 'date.timezone' set in the PHP configuration your WHMCS installation is using by navigating to 'Utilities -> System -> PHP Info'. If they are different, you will need to work with your hosting provider or server administrator to set the same 'date.timezone' in the PHP configuration your WHMCS installation is using and the one for the command line on the server.