Again, timezone setup

This is the article of an example of how to fix timezone issue with playSMS.

This is my server\’s time, its in UTC:

[code lang=text]
$ date
Wed Aug 1 03:22:21 UTC 2018
[/code]

And then I check where is my php.ini, both for php-cli and php-fpm (I\’m using Nginx with php-fpm):

[code lang=text]
$ php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php/7.0/cli
Loaded Configuration File => /etc/php/7.0/cli/php.ini
[/code]

I looked for date.timezone option on php.ini, edit it and set the option to my timezone Asia/Jakarta, its UTC+7. When done it will be like this:

[code lang=text]
$ cat /etc/php/7.0/cli/php.ini | grep date.timezone
; http://php.net/date.timezone
date.timezone = Asia/Jakarta
[/code]

I also set it in php-fpm php.ini, not just php-cli php.ini:

[code lang=text]
$ cat /etc/php/7.0/fpm/php.ini | grep date.timezone
; http://php.net/date.timezone
date.timezone = Asia/Jakarta
[/code]

Please note you need to restart php-fpm when you changed php-fpm php.ini.

In playSMS I set my default timezone to +0700 (its UTC+7):
\"\"

Restart playsmsd and do some test, for example send an SMS with a schedule.

As a reference please read this:
https://playsms.org/2013/12/07/fix-timezone-problem/

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.

Continue reading “Fix Timezone Problem”