# Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/app/src/Utils/DateHelper.php on line 10

- **ID:** `php/date-timezone-ini-error`
- **Domain:** php
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The PHP timezone is not configured in php.ini (date.timezone) or via date_default_timezone_set(), causing PHP to fall back to a system guess which may be unreliable.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| PHP 5.6 | active | — | — |
| PHP 7.0 | active | — | — |
| PHP 7.4 | active | — | — |
| PHP 8.0 | active | — | — |
| PHP 8.1 | active | — | — |
| PHP 8.2 | active | — | — |
| PHP 8.3 | active | — | — |

## Workarounds

1. **Set the timezone in php.ini: `date.timezone = 'America/New_York'` (replace with your timezone). Restart the web server or PHP-FPM.** (95% success)
   ```
   Set the timezone in php.ini: `date.timezone = 'America/New_York'` (replace with your timezone). Restart the web server or PHP-FPM.
   ```
2. **Add `date_default_timezone_set('America/New_York');` at the top of your PHP script or in a bootstrap file (e.g., index.php or config.php).** (90% success)
   ```
   Add `date_default_timezone_set('America/New_York');` at the top of your PHP script or in a bootstrap file (e.g., index.php or config.php).
   ```
3. **For CLI scripts, set the timezone via environment variable: `export TZ='America/New_York'` before running the script.** (85% success)
   ```
   For CLI scripts, set the timezone via environment variable: `export TZ='America/New_York'` before running the script.
   ```

## Dead Ends

- **** — The .user.ini file is ignored in module mode; the setting must be in the main php.ini. (70% fail)
- **** — PHP validates the timezone string; a typo results in fallback behavior. (80% fail)
- **** — The setting may not propagate to all PHP contexts (e.g., CLI or subrequests). (65% fail)
