0

I have several Drupal 7 sites using the same installation in the same server. Two of those sites are returning "Europe/London" when running date_default_timezone_get(). This timezone is different from the one returned by drupal_get_user_timezone() or variable_get('date_default_timezone'), which (correctly) return "America/Denver". For the rest of the sites the returned timezone is the same for all three functions.

The fact that I get a different timezone with the php function is creating issues for those two sites; for example, token replacements of date field are returning London time, not the site timezone's time.

What may be causing this discrepancy? Is there any way to correct that? I tried including the line date.timezone = "America/Denver" in php.ini without success.

I'm running php5.6 on Apache 2.4.36

1 Answer 1

0

I figured out what was going on. I am using the module print with the external library mPDF (version 6.0). mPDF.php was changing my default timezone to "Europe/London" in line 80 (this bug has been reported in this version of mPDF). Apparently this line was running after drupal_session_initialize() in session.inc, which sets the default timezone for the session to match the site's selected timezone.

What's strange is that mPDF was only affecting 2 of my sites. Apparently the session initialization in the other sites was running after the mPDF command? I commented out those lines and all the timezones now match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.