Fix Timezone Problem

Messages are not delivered, they are queued. Admin saw all messages in View SMS queue.

Usually, before 0.9.9.2, this is the case of daemon scripts issue, they are not running or running improperly such as wrong path configured in /etc/default/playsms.

But since I introduced SMS scheduler, a way to schedule delivery of submitted SMS through Send SMS page or webservices, one more issue unfortunately has emerged. It’s the timezone settings, PHP simply cannot determine exact timezone used in the script. The result is every SMS submitted NOW will end up being scheduled for next hour depend on the timezone that actually guessed by PHP.

A discussion in the group shows an example of user experiencing this issue.

So, if you experienced an issue like the first paragraph in this article, and you already make sure that all daemon scripts are running and well configured, then its time to check the timezone settings.

Please note I’m using Ubuntu Desktop 13.10 and apache2 as web server, also installed php5-cli. These information are important to know which PHP configuration file I need to configure.

1. Edit php.ini used by php5-cli: /etc/php5/cli/php.ini

2. Look for date.timezone option. In my php.ini its in line 960.

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

3. As you can see, by default the date.timezone option is commented (a semi-colon in front of date.timezone). We need to un-comment it and add your server’s timezone. In my case, I’m using my GMT+7 timezone name Asia/Jakarta. The final edit will be like this:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Jakarta

4. Do the same for php.ini used by apache2: /etc/php5/apache2/php.ini. Only this time you also need to restart apache2

/etc/init.d/apache2 restart

5. Make sure that your Default timezone setting inside playSMS admin menu, Administration -> Main configuration, is set to correct timezone, in my case to +0700 for GMT+7 or Asia/Jakarta.

For next release I’m planning to use timezone naming instead of offset, and make sure that date.timezone options is set from playSMS (when allowed by php.ini).

QA please visit playSMS Forum.

One thought on “Fix Timezone Problem

Comments are closed.