Difference between revisions of "Changing Timezone"
(→Timezone the cron operates under) |
|||
(3 intermediate revisions by 2 users not shown) | |||
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 on the server clock and the timezone setting in your PHP configuration. | + | |
+ | The time under which your WHMCS installation will run is based on the server clock and the timezone setting in your PHP configuration. If the time displayed in WHMCS is incorrect, there are two options for correcting it: | ||
*Change the server clock directly | *Change the server clock directly | ||
− | *Edit the PHP configuration, specifying a different timezone. | + | *Edit the PHP configuration on the server, specifying a different timezone. |
Changing the server clock may not be desirable if you host clients on the server. It also requires <tt>root</tt> access, so the second option is best for the majority of users. Some hosting providers allow you to change the PHP configuration on an individual directory by creating a <tt>php.ini</tt> file within the WHMCS directory. In that situation, you could add the following line: | Changing the server clock may not be desirable if you host clients on the server. It also requires <tt>root</tt> access, so the second option is best for the majority of users. Some hosting providers allow you to change the PHP configuration on an individual directory by creating a <tt>php.ini</tt> file within the WHMCS directory. In that situation, you could add the following line: | ||
Line 16: | Line 17: | ||
===Timezone the cron operates under=== | ===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's important to ensure the timezone WHMCS's PHP configuration uses is the same as the one in the PHP configuration the command line uses, and, by extension, the PHP configuration that the cron job 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's important to ensure the timezone WHMCS's PHP configuration uses is the same as the one in the PHP configuration the command line uses, and, by extension, the PHP configuration that 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 '''[[Automation_Settings|Setup > Automation Settings | + | If this is different, you will find that your cron job is executing at an unexpected or different time from the setting at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Automation_Settings|Automation Settings]]''' or, prior to WHMCS 8.0, '''Setup > Automation Settings'''. |
+ | |||
+ | To check this, run the following command at the server command line while logged in as the same user under whom the cron job is running: | ||
<div class="source-cli"> | <div class="source-cli"> | ||
Line 24: | Line 28: | ||
</div> | </div> | ||
− | You can compare the output of this command to the <tt>date.timezone</tt> 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 <tt>date.timezone</tt> in the PHP configuration your WHMCS installation is using and the one for the command line on the server. | + | You can compare the output of this command to the <tt>date.timezone</tt> 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 <tt>date.timezone</tt> in the PHP configuration your WHMCS installation is using and the one for the command line on the server. |
Latest revision as of 18:51, 19 April 2022
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. If the time displayed in WHMCS is incorrect, there are two options for correcting it:
- Change the server clock directly
- Edit the PHP configuration on the server, 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 the second option is best for the majority of users. Some 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's important to ensure the timezone WHMCS's PHP configuration uses is the same as the one in the PHP configuration the command line uses, and, by extension, the PHP configuration that 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 Configuration () > System Settings > Automation Settings or, prior to WHMCS 8.0, Setup > Automation Settings.
To check this, run the following command at the server command line while logged in as the same user under whom 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.