Get The Most Affordable Hosting in the World!
Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.
Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!
Get Started Now!Many server configurations utilize a separate php.ini file in the command line or cron engine than the web server uses. This can sometimes cause issues with having different configurations. Fortunately there are ways to diagnose and troubleshoot this.
Identifying the timezone used via SSH
The first method to identify which PHP timezone is being used by your cron engine is to use an SSH session.
Using a computer-based terminal:
Open your terminal of choice and login to your server via SSH. Login with the same user account as your webserver uses, or that your WHMCS installation uses.
It is best to avoid using root during troubleshooting as a properly configured server does not utilize the root user to run the web server or cron processes.
Once logged into the server, simply execute the following command:
php -i | grep "date.timezone"
![CLI Screenshot](https://media.screensteps.com/image_assets/assets/005/009/337/original/c96da08e-0772-4f1b-86e7-1bf5997e451e.png)
Doing this will show the timezone being used when executing the php command. If you are forcing a specific version of PHP, or using the complete path you would simply substitute that for the php variable used above:
![CLI Screenshot](https://media.screensteps.com/image_assets/assets/005/009/335/original/e060a214-89c1-4c38-b962-79740481467e.png)
Using the cPanel based terminal:
Another option to check this is via the Terminal option within cPanel. This feature was added in cPanel & WHM Version 72. Various settings must be set in order for your account to have the Terminal option. You can review the cPanel Documentation for this feature on their Documentation Site here.
Login to your cPanel and choose the Terminal option from the Advanced section.
![cPanel Terminal Icon](https://media.screensteps.com/image_assets/assets/001/857/397/medium/3585fda5-3ddc-4ac3-9e3e-e47c43e21b0e.png)
Once the terminal is opened, the steps are identical to using the Computer-Based Terminal above.
Using the Cron Job
One final option to check is via the cron engine itself. You can modify, or create, a cron job task to put this output to a file which can be read. For this example, we will be using cPanel.
First, Login to your cPanel and navigate to the Cron Jobs area, found under the Advanced section.
![cPanel Cron Jobs Icon](https://media.screensteps.com/image_assets/assets/001/857/411/medium/e3d9f133-2657-4c37-abfc-199dd486b7f0.png)
Once the cron job section is loaded, make note of the PHP path or variable being used by your existing WHMCS cronjob, as this is the path we will want to follow for troubleshooting.
![php](https://media.screensteps.com/image_assets/assets/001/857/399/original/ec3928e9-27fc-48de-a193-b1460c778431.png)
This next step you have 2 options. You can modify the existing cronjob, or you can create a new one which is the preferred method. We will use the second option.
We will now create a new cronjob that runs every minute with a command similar to the one below:
php -i | grep "date.timezone" > /home/v76whmcssupport/public_html/whmcs/crons/phpoutput.txt
In this example, to make the file easy to find we are placing the output file in the same folder as the crons directory. In this case you would set that path to your crons directory path:
![cPanel Cron Job Configuration Interface](https://media.screensteps.com/image_assets/assets/005/009/333/original/a81211da-80b4-4fdb-abf0-8370b37174d7.png)
We open up to the crons directory to look at the file output of the cron we just created. We will do this via the File Explorer in cPanel, but you could also check via FTP.
Note: The cron is setup to run 1 time per minute, so you must wait at least 1 minute (60 seconds) before the cron will be invoked or the output file will not be there.
![View](https://media.screensteps.com/image_assets/assets/001/857/403/original/5e035537-6322-487a-8ea8-00f6c9fd8ba8.png)
We can now see the output by right clicking the file and choosing view:
![UTC](https://media.screensteps.com/image_assets/assets/005/009/339/original/8aa04fc4-4961-45f8-a88a-02f3099fec7f.png)
In this example a timezone of UTC
is being used for the cron job.
After viewing the output, you should now remove the temporary cronjob to eliminate this unnecessary task from running.
What do I do with this information?
When looking for the proper PHP.ini file to edit, it is typically because settings need to be modified to resolve timestamp mismatches. You will now need to work with your SysAdmin or Web Host to properly edit the PHP.ini to ensure all of the requirements are met, which should resolve any cron issues!
Resolving a Cron PHP Version Mismatch Warning
Once the timezone being used by the cron on your system has been identified, it can be compared against that used by the web server:
1. Navigate to Utilities > System > PHP Info
2. Examine the date.timezone value:
![America/Chicago](https://media.screensteps.com/image_assets/assets/005/009/331/original/69dd2167-b6f5-4273-a77f-e242571ceee8.png)
3. In this example the date.timezone is America/Chicago
This indicates the CST timezone is being used for the web server environment.
In this example the cron job is using UTC. Whilst the web server is using CST
Such timezone differences can cause unexpected behavior and errors in WHMCS
4. Work with your server admin/hosting provider to harmonise the timezone setting used in both locations.
One option is to adjust the cron job command to use the exact same timezone as the web server. Eg:
php -d date.timezone='$timezone' /path/to/crons/cron.php
Where $timezone
is the desired PHP timezone value.
Continuing our example, this might produce a cron job command which looks something like:
php -d date.timezone='America/Chicago' -q /home/v76whmcssupport/public_html/whmcs/crons/cron.php
Your server admin/hosting provider will be best placed to advise upon the most appropriate solution for your particular server environment and configuration as well as the file paths to use. We recommend consulting with them on any changes beforehand.