symfony / symfony

The Symfony PHP framework
https://symfony.com
MIT License
29.62k stars 9.42k forks source link

date.timezone exception symfony 4 #25850

Closed ouerghi closed 6 years ago

ouerghi commented 6 years ago
Q A
Bug report? yes
Feature request? yes/no
BC Break report? yes/no
RFC? yes/no
Symfony version 4.3

Runtime Notice: DateTime::createFromFormat(): We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead

in ResponseHeaderBag.php (line 336)

at ResponseHeaderBag->initDate()in ResponseHeaderBag.php (line 41)

private function initDate()
    {
        $now = \DateTime::createFromFormat('U', time());
        $now->setTimezone(new \DateTimeZone('UTC'));
        $this->set('Date', $now->format('D, d M Y H:i:s').' GMT');
    }
}
xabbuh commented 6 years ago

Can you be a bit more precise? When exactly does this happen? How can we reproduce it?

ouerghi commented 6 years ago

after downloading symfony by accessing the site/public folder I find this message composer create-project symfony/skeleton symfony4 ,when i acced to public folder i get this message datetime

javiereguiluz commented 6 years ago

@ouerghi maybe the timezone is not configured in PHP config file? Try adding this to your php.ini:

date.timezone = Europe/Berlin
ouerghi commented 6 years ago

I didn't know the problem but I referred to this page and wrote this script and now it works I think I need to configure php. ini in all directories. https://assistance.1and1.fr/hebergement-c65619/programmation-c65626/php-c65653/copier-automatiquement-le-fichier-phpini-dans-tous-les-repertoires-a703438.html

ouerghi commented 6 years ago

always the same problem when I try to change the root other than /**

xabbuh commented 6 years ago

Did you make sure that you modified the php.ini file that is used for the CLI binary (you can check which file to edit using php7.1-cli --ini)?

xabbuh commented 6 years ago

And you can use php7.1-cli -i to check which config values are actually used by the CLI.

ouerghi commented 6 years ago

yes I have checked with phpinfo () the date value. timezone is well Europe/paris.

xabbuh commented 6 years ago

Can you please show the output of /usr/bin/php7.1-cli -i?

ouerghi commented 6 years ago

with the -i option of php-cli date. timezone has no value which command allows me to change the date value. timezone with php-cli (I'm on a shared server I can't change the php. ini )

xabbuh commented 6 years ago

You can define ini entries using the -d option when using the CLI binary like this:

/usr/bin/php7.1-cli -d date.timezone=Europe/Berlin ...

I am closing here as this is a server configuration issue and there is nothing to fix in Symfony.