I am wondering if PHP Setting can be adjusted? All the Express Dates are in UTC and when I try to edit a record, the date goes back by 1 day. The server has Americas/Denver and MySQL has MST as the timezone.
Thanks!
Joaquin
I am wondering if PHP Setting can be adjusted? All the Express Dates are in UTC and when I try to edit a record, the date goes back by 1 day. The server has Americas/Denver and MySQL has MST as the timezone.
Thanks!
Joaquin
Hi Joaqin,
you can change the timezone in the php.ini.
[Date]
; Defines the de
1. List item
fault timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Americas/Denver"
If you are not sure, where your php.ini is located you can create a tiny php file with
<?php
phpinfo();
?>
This page will display a lot of information about your server and settings, so after you read the information of “loaded configuration file” it is a good idea to delete this file again.
I am pretty sure that it is also possible to change the time zone in ConcreteCMS. In any case, you could do this during the installation.
Maybe this is helpful: Time Zone
Best!
@eCCMS I tried that timezone setting and it did not change anything.
When I run a plain PHP file and print the timezone I see:
root@ubuntu-lts-22:/var/www/html/rhm/application/src# php test.php
The current server timezone is: America/Denver
When I run the same file with the Concrete environment loaded I see:
root@ubuntu-lts-22:/var/www/html/rhm/application/src# …/…/concrete/bin/concrete5 c5:exec test.php
The current server timezone is: UTC
DateTime Object
(
[date] => 2024-06-18 00:00:00.000000
[timezone_type] => 3
[timezone] => UTC
)
The DateTime Object lines are from a print_r() of a date value from an
Express Object.
I have confirmed both the cli and apache2 php.ini settings are pointing to America/Denver.
Crazy stuff! I’ll keep digging.
Thanks!
I read your last post with disabled brain. So I wrote stupid things.
Sorry.
No problem @eCCMS ! Yes I have two php.ini files:
root@ubuntu-lts-22:~# find / -name php.ini -print
/etc/php/8.1/cli/php.ini
/etc/php/8.1/apache2/php.ini
Both are pointing to America/Denver. I even installed @JohntheFish 's ele-PHP-ant extension which runs phpinfo() and it looks good too.
oh, result of php --ini
root@ubuntu-lts-22:~# php --ini
Configuration File (php.ini) Path: /etc/php/8.1/cli
Loaded Configuration File: /etc/php/8.1/cli/php.ini
root@ubuntu-lts-22:~# more /etc/php/8.1/cli/php.ini | grep timezone
; Defines the default timezone used by the date functions
; PHP: Runtime Configuration - Manual
date.timezone = “America/Denver”
It’s probably not quite the same thing, but perhaps they are connected in some way:
Very interesting! Thank you @eCCMS I will check out that commit and see if the merged fix addresses my issue.
@eCCMS I was able to overcome this issue by setting the timezone in this file:
/application/config/app.php
With:
<?php
return [
'server_timezone' => 'America/Denver',
];
Secondly I ensured MySQL had a timezone of SYSTEM
mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| SYSTEM |
+--------------------+
1 row in set (0.00 sec)
Lastly, on the Timezone page from System Settings (Settings/Default Timezone) I selected “America/Denver”. My server was already set to MST.
Phew!
Joaquin