This script:
<?php
$dateTime = new DateTime();
?>
Throws this error:
PHP Fatal error: Uncaught Exception: DateTime::__construct(): Invalid date.timezone value 'America/Argentia/Buenos_Aires', we selected the timezone 'UTC' for now. in /var/www/html/date.php:2
Stack trace:
#0 /var/www/html/date.php(2): DateTime->__construct()
#1 {main}
thrown in /var/www/html/date.php on line 2
Pay attention to the timezone "Argentia", looks like a typo, but I do not know WHERE it's configured.
What I already try:
- I edited the timezone in php.in:
date.timezone = "America/Argentina/Buenos_Aires"
and restart apache2 service. - I checked the server timezone (that's ok):
# timedatectl | grep "Time zone"
Time zone: America/Argentina/Buenos_Aires (-03, -0300)
Note:
Adding the following line at the start of the script
date_default_timezone_set("America/Argentina/Buenos_Aires");
The problem "is solved", but I am looking for a general solution to the problem.
System info: Ubuntu 16.04 and PHP 7.4
Thanks!