Mobile app version of vmapp.org
Login or Join
Voss4911412

: Why is the php.ini timezone setting is not used to determine when a PHP cron job runs? I use shared hosting at Bluehost and changed the default date.timezone to UTC in my php.ini. Everything

@Voss4911412

Posted in: #Bluehost #Cron #Php #Timezone

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 ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Voss4911412

1 Comments

Sorted by latest first Latest Oldest Best

 

@Becky754

I've found that after I changed my php.ini timezone setting to UTC the Bluehost shared hosting cron service was still using the MDT (Mountain Daylight Time) timezone which has an offset of -6 hours. This is probably due to the shared hosting as stated by @dan in the comments, and there is nothing to change that but to switch to a dedicated hosting.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme