I use shared hosting at Bluehost and changed the default date.timezone
to UTC in my php.ini
. Everything works fine with my PHP script and date()
return the UTC time as expected.
The problem occurs with the crontab, because when I enter a cron job to be executed every Monday at 00:15 AM UTC with the following line :
15 0 * * 1 php /home2/mywebsite/public_html/php/myscript.php
Then the script is not executed at 00:15 AM UTC time but at 00:15 AM UTC-6 which is Western America I guess. For this reason I need to set it at 06:15 PM of the day before, which is Sunday, to have it executed at Monday at 00:15 AM UTC:
15 18 * * 0 php /home2/mywebsite/public_html/php/myscript.php
I asked their support but they said they cannot help with the crontab. For them it just work.
Is it related to the shared hosting and is there a possibility to change this so that crontab service use my php.ini
timezone setting ?