Repository navigation
fix(php): respect project timezone, fixes #69 - #73
Merged
Merged
Conversation
## Short Summary (TL;DR) PHP in FrankenPHP always used `UTC` and ignored the project timezone. DDEV's `start.sh` now updates `/etc/php-zts/php.ini` too. ## The Issue - Fixes #69 On startup, DDEV's `start.sh` sets `date.timezone` from `TZ`, but only in `$(find /etc/php -name php.ini)`. The add-on copies `php.ini` to `/etc/php-zts/php.ini` at build time, so the php-zts config kept `date.timezone = UTC`: ``` $ ddev php -r 'var_dump(date_default_timezone_get());' string(3) "UTC" ``` The tests didn't catch it, because the test `.ddev/php/php.ini` overrode `date.timezone` itself. ## How This PR Solves The Issue Patches `start.sh` to also search `/etc/php-zts`: ``` find /etc/php /etc/php-zts -name php.ini ``` This line is the same in every DDEV version from v1.24.10 (the minimum supported) to HEAD. ## Manual Testing Instructions ```bash ddev config --timezone=Europe/London ddev add-on get ddev/ddev-frankenphp --pr REPLACE_ME_WITH_THIS_PR_NUMBER ddev restart ddev php -r 'var_dump(date_default_timezone_get());' ``` It should print `string(13) "Europe/London"`. ## Automated Testing Overview - `setup()` runs `ddev config --timezone=Europe/London`, and `health_checks` checks `date_default_timezone_get()` in PHP. - The test `.ddev/php/php.ini` (from #41) now sets the unimportant `highlight.comment = #123456` instead of `date.timezone`, so it no longer hides the project timezone. `health_checks` checks it with `ini_get()`. ## Release/Deployment Notes Users need to run `ddev add-on get ddev/ddev-frankenphp` and `ddev restart` to get the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short Summary (TL;DR)
PHP in FrankenPHP always used
UTCand ignored the project timezone. DDEV'sstart.shnow updates/etc/php-zts/php.initoo.The Issue
On startup, DDEV's
start.shsetsdate.timezonefromTZ, but only in$(find /etc/php -name php.ini). The add-on copiesphp.inito/etc/php-zts/php.iniat build time, so the php-zts config keptdate.timezone = UTC:The tests didn't catch it, because the test
.ddev/php/php.inioverrodedate.timezoneitself.How This PR Solves The Issue
Patches
start.shto also search/etc/php-zts:This line is the same in every DDEV version from v1.24.10 (the minimum supported) to HEAD.
Manual Testing Instructions
It should print the configured timezone, for example
string(13) "Europe/London", or your host timezone iftimezoneis unset.Automated Testing Overview
setup()runsddev config --timezone=Europe/London, andhealth_checkschecksdate_default_timezone_get()in PHP..ddev/php/php.ini(from Custom PHP configuration does not take effect in FrankenPHP #41) now sets the unimportanthighlight.comment = #123456instead ofdate.timezone, so it no longer hides the project timezone.health_checkschecks it withini_get().Release/Deployment Notes
Users need to run
ddev add-on get ddev/ddev-frankenphpandddev restartto get the fix.🤖 Generated with Claude Code