When installing Drupal 8.2.x dev i get an error with translations.

Warning: DateTime::createFromFormat(): 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 Symfony\Component\HttpFoundation\Response->sendHeaders() (line 331 of vendor/symfony/http-foundation/Response.php).
Symfony\Component\HttpFoundation\Response->sendHeaders() (Line: 371)
Symfony\Component\HttpFoundation\Response->send() (Line: 629)
install_run_task(Array, Array) (Line: 530)
install_run_tasks(Array) (Line: 115)
install_drupal(Object) (Line: 39)
Vertalingen voor drupal aan het importeren. (15%).

Warning: DateTime::createFromFormat(): 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 Symfony\Component\HttpFoundation\Response->sendHeaders() (line 331 of vendor/symfony/http-foundation/Response.php).
Symfony\Component\HttpFoundation\Response->sendHeaders() (Line: 371)
Symfony\Component\HttpFoundation\Response->send() (Line: 629)
install_run_task(Array, Array) (Line: 530)
install_run_tasks(Array) (Line: 115)
install_drupal(Object) (Line: 39)
Warning: DateTime::createFromFormat(): 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 Symfony\Component\HttpFoundation\Response->sendHeaders() (line 331 of vendor/symfony/http-foundation/Response.php).
Symfony\Component\HttpFoundation\Response->sendHeaders() (Line: 371)
Symfony\Component\HttpFoundation\Response->send() (Line: 629)
install_run_task(Array, Array) (Line: 530)
install_run_tasks(Array) (Line: 115)
install_drupal(Object) (Line: 39)

Comments

mr.infinity created an issue. See original summary.

mr_infinity’s picture

Title: Datetime » Datetime error on install translation
sasanikolic’s picture

StatusFileSize
new124.25 KB

I'm also having this error. It even displays as a warning when running tests.

sasanikolic’s picture

Figured out that this is caused by a misconfigured php.ini. I think we can close this.

amateescu’s picture

Component: transliteration system » other
Status: Needs work » Closed (cannot reproduce)

Yup, that's definitely a PHP misconfiguration.

ench0’s picture

sasanikolic and amateescu - I am glad that have figured out what the problem is but maybe you could share the solution? After all that's the main idea of issues database, isn't it? Please share here how to fix this. Thank you.

ench0’s picture

Status: Closed (cannot reproduce) » Needs review

Happens on my new installation of Panopoly 8.x-2.0-alpha4.

amateescu’s picture

Status: Needs review » Closed (cannot reproduce)

@ench0, the solution is in the PHP warning message itself, if you read it. You need to set date.timezone in your php.ini. See http://php.net/manual/en/datetime.configuration.php

ench0’s picture

Thank you for clarifying this, amateescu.

And is it normal that drupal does not create a php.ini file during the installation? I don't have a php.ini file in my drupal directory, so I created one and added my date.timezone as per http://php.net/manual/en/timezones.php and restarted httpd but that did not solve the issue...

I then edited the php.ini file in /etc after which the error disappeared, but I thought that a local php.ini file is supposed to override the global one....

Thanks.

diamondsea’s picture

bogdog400’s picture

BTW, I continue to encounter this issue on 1and1's shared hosting. They don't seem very helpful.

srikanth.g’s picture

unable to install drupal 8.5.1
Warning: DateTime::createFromFormat(): 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 Symfony\Component\HttpFoundation\ResponseHeaderBag->initDate() (line 336 of vendor\symfony\http-foundation\ResponseHeaderBag.php).
Symfony\Component\HttpFoundation\ResponseHeaderBag->initDate() (Line: 41)
Symfony\Component\HttpFoundation\ResponseHeaderBag->__construct(Array) (Line: 199)
Symfony\Component\HttpFoundation\Response->__construct() (Line: 68)
Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 76)
Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 1005)
install_display_output(Array, Array, Array) (Line: 260)
_drupal_log_error(Array, 1) (Line: 600)
_drupal_exception_handler(Object)

bogdog400’s picture

I've resorted to adding an extra line to vendor/symfony/http-foundation/ResponseHeaderBag.php so the initialization function now sets the default time zone like this. This has made the problem go away for me. It's a total hack and it's a pain that we need it, but after I included it the installation process works.

 public function __construct(array $headers = array())
    {
        parent::__construct($headers);

       date_default_timezone_set('America/New_York');//or change to whatever timezone you want

        if (!isset($this->headers['cache-control'])) {
            $this->set('Cache-Control', '');
        }

        /* RFC2616 - 14.18 says all Responses need to have a Date */
        if (!isset($this->headers['date'])) {
            $this->initDate();
        }
    }
lissy’s picture

Here is the same problem with a completely fresh installation of 8.5.1
Strict errors are excluded from reporting in php.ini and date.timezone was set to Europe/Berlin.
Installation aborts with error messages.

sajosh’s picture

Same here.

Strict Standards: DateTime ... ResponseHeaderBag.php on line 336

After database screen, I get ...
The website encountered an unexpected error. Please try again later.
RuntimeException: Failed to start the session because headers have already been

I tried php.ini in the main drupal folder. No luck. Then copied to sites/default folder, still no luck.

D8.5.1, mysql 5.5, php 7.2 on 1and1.com shared

"Solved" it by putting .user.ini file with date.timezone = 'America/New_York' in the main drupal folder.

Credit: https://www.drupal.org/forum/support/installing-drupal/2017-10-25/cannot...

However, I suspect the .user.ini or php.ini is the cause of another problem after installation completes ... internal server error for any page except the main one.

sajosh’s picture

Ok. Solved it for real (for my case ... subfolder subdomain for testing).

The 500 internal server error solved by uncommenting "ReWriteBase /" line 123 in .htaccess ... because subdomain. phew

The Strict Standards error solved by .user.ini with only date.timezone = America/New_York for my case (1and1 shared). Didn't need php.ini (might need it later for other settings but not for the strict error.)

goz’s picture

Same thing here, on a 1and1 shared, fixed adding a .user.ini file with date.timezone = Europe/Berlin