Summary
entrypoint_fpm.sh sets date.timezone only in /etc/php/*/fpm/php.ini, but not in /etc/php/*/cli/php.ini.
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.
I didn't notice this during my previous checks and tests, since I was manually triggering pulls and pushes, for example. However, it appears that the set time zone is indeed being used in those cases.
Steps to reproduce
- Set
TZ to a time zone other than UTC, e.g.: TZ=Europe/Berlin in the container environment.
- Take a look in
logs/misp-workers.log
- Observe that the logged time is UTC, not Europe/Berlin.
Expected behaviour
date.timezone in both fpm/php.ini and cli/php.ini reflects the TZ env var.
Fix
Add the following loop to change_php_vars() in entrypoint_fpm.sh:
for FILE in /etc/php/*/cli/php.ini; do
[[ -e $FILE ]] || break
sed -i "s|^;date.timezone =.*|date.timezone = ${TZ}|" "$FILE"
done
Summary
entrypoint_fpm.shsetsdate.timezoneonly in/etc/php/*/fpm/php.ini, but not in/etc/php/*/cli/php.ini.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
TZenvironment variable.I didn't notice this during my previous checks and tests, since I was manually triggering pulls and pushes, for example. However, it appears that the set time zone is indeed being used in those cases.
Steps to reproduce
TZto a time zone other than UTC, e.g.:TZ=Europe/Berlinin the container environment.logs/misp-workers.logExpected behaviour
date.timezonein bothfpm/php.iniandcli/php.inireflects theTZenv var.Fix
Add the following loop to
change_php_vars()inentrypoint_fpm.sh: