Skip to content

fix: set date.timezone in PHP CLI php.ini#414

Open
LSI-ZuagrastaWastl wants to merge 24 commits into
MISP:masterfrom
LSI-Bayern:master
Open

fix: set date.timezone in PHP CLI php.ini#414
LSI-ZuagrastaWastl wants to merge 24 commits into
MISP:masterfrom
LSI-Bayern:master

Conversation

@LSI-ZuagrastaWastl
Copy link
Copy Markdown
Contributor

Problem

change_php_vars() only patched date.timezone in FPM's php.ini.
PHP-CLI (used by MISP workers/console commands) kept the default UTC timezone, ignoring the TZ env var.
MISP background workers (e.g. CakePHP console commands) use the CLI SAPI and therefore ignore the FPM timezone config. As a result, all worker-generated timestamps use the container's default UTC regardless of the TZ environment variable.

Change

Added a loop to entrypoint_fpm.sh that applies date.timezone = ${TZ} to all /etc/php/*/cli/php.ini files, consistent with the existing FPM handling.

Testing

  1. Set TZ to a time zone other than UTC, e.g.: TZ=Europe/Berlin in the container environment.
  2. Take a look in logs/misp-workers.log
  3. Observe that the logged time is Europe/Berlin.

Fixes #413

P.S. I thought creating a separate entrypoint script, such as entrypoint_cli.sh, would be a bit too much overhead for a single change. If you ever want to modify or set more PHP CLI settings, this one will be moved along with them.

Add timezone setting option to template.env
- Add timezone environment variable to all services
- Setting Default to "UTC"
- Add timezone configuration for PHP in docker-compose file.
- Replace PHP timezone in misp-core with the new config-file tzone.ini

Perhaps there are better solutions for changing the time zone from PHP during runtime.
Updated PHP timezone configuration 
and added symlink for timezone for supervisord.
sed dosen´t use "?"  so PHP_TIMEZONE was setting in php.ini
PHP_TIMEZONE wasn`t in template.env and so most not in use.
TZ Variable the global Timezone variable in this Project
Removed timezone configuration from docker-compose.
With the "sed fix" in the entrypoint_fpm.sh, No need to mount a separate file now
Updated timezone setting method for supervisord compatibility with debian standard methode
add `-` so default (UTC) is in use, if TZ is not in use
PHP_timezone isn`t in use
TZ exist
CET or CEST not useable timezone in /usr/share/zoneinfo/
Remove default value for TZ when setting timezone.
Remove the space from the pattern (`= .*` → `=.*`) to make it more flexible.
Remove setting of /etc/timezone for compatibility.
It appears that not all Supervisors use the TZ value.
with this setting, MISP-Workers use Timezone from TZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP CLI timezone not set – MISP workers run in wrong timezone

1 participant